Skip to content

Commit d46aca9

Browse files
authored
Merge branch 'main' into feature/add-delete-whatif
2 parents b7afe15 + 784daea commit d46aca9

File tree

125 files changed

+4550
-493
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+4550
-493
lines changed

.pipelines/DSC-Official.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ extends:
246246
- job: BuildLinuxArm64Musl
247247
dependsOn: SetPackageVersion
248248
variables:
249-
LinuxContainerImage: 'onebranch.azurecr.io/linux/ubuntu-2004-arm64:latest'
249+
LinuxContainerImage: 'onebranch.azurecr.io/linux/ubuntu-2204-arm64:latest'
250250
PackageVersion: $[ dependencies.SetPackageVersion.outputs['Package.Version'] ]
251251
AzToken: $[ dependencies.SetPackageVersion.outputs['AzToken'] ]
252252
ob_outputDirectory: '$(Build.ArtifactStagingDirectory)'

.vscode/launch.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
"type": "lldb",
2121
"request": "attach",
2222
"pid": "${command:pickMyProcess}",
23+
"expressions": "simple",
24+
"preRunCommands": [
25+
// !! change this path if you placed the script somewhere else !!
26+
"command script import ~/.vscode/rust_prettifier_for_lldb.py"
27+
],
2328
},
2429
{
2530
"name": "(Windows) Attach",

build.ps1

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,24 @@ if ($null -ne $packageType) {
236236
& $rustup default stable
237237
}
238238

239+
if ($Clippy) {
240+
Write-Verbose -Verbose "Installing clippy..."
241+
if ($UseCFS) {
242+
cargo install clippy --config .cargo/config.toml
243+
} else {
244+
if ($architecture -ne 'current') {
245+
write-verbose -verbose "Installing clippy for $architecture"
246+
rustup component add clippy --target $architecture
247+
} else {
248+
write-verbose -verbose "Installing clippy for current architecture"
249+
rustup component add clippy
250+
}
251+
}
252+
if ($LASTEXITCODE -ne 0) {
253+
throw "Failed to install clippy"
254+
}
255+
}
256+
239257
## Test if Node is installed
240258
## Skipping upgrade as users may have a specific version they want to use
241259
if (!(Get-Command 'node' -ErrorAction Ignore)) {
@@ -339,6 +357,7 @@ if (!$SkipBuild) {
339357
"tree-sitter-dscexpression",
340358
"tree-sitter-ssh-server-config",
341359
"security_context_lib",
360+
"lib/osinfo_lib",
342361
"dsc_lib",
343362
"dsc",
344363
"dscecho",

docs/concepts/resources/capabilities.md

Lines changed: 46 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ resource. DSC performs the synthetic test by:
7676
1. Invoking the **Get** operation on the resource to retrieve the actual state of the instance.
7777
1. Synthetically testing each property for the desired state of an instance against the actual
7878
state returned. The synthetic test:
79-
79+
8080
- Uses strict, case-sensitive equivalence for strings.
8181
- Uses simple equivalence for numerical, boolean, and null values.
8282
- For arrays, item order doesn't matter. Arrays are considered equivalent if both the desired
@@ -134,32 +134,59 @@ manifest.
134134
A resource with the `export` capability supports enumerating every instance of the resource with
135135
the **Export** operation.
136136

137-
You can use resources with this capability with the following commands:
137+
You can use resources with the `export` capability with the following commands:
138138

139-
- [dsc config export][15] to return a configuration document
140-
representing the actual state for every instance of each resource defined in the input document.
141-
- [dsc resource export][16] to return a configuration document
142-
representing the actual state for every instance of the input resource.
143-
- `dsc resource get` with the [--all][17] option to return
144-
the actual state of every instance of the input resource.
139+
- [dsc config export][15] to return a configuration document representing the actual state for
140+
every instance of each resource defined in the input document.
141+
- [dsc resource export][16] to return a configuration document representing the actual state for
142+
every instance of the input resource.
143+
- `dsc resource get` with the [--all][17] option to return the actual state of every instance of
144+
the input resource.
145145

146146
A command resource has this capability when it defines the [export][18] property in its resource
147147
manifest.
148148

149+
### Synthetic export
150+
151+
When a resource doesn't have the `export` capability, DSC uses a synthetic export for instances of
152+
the resource. DSC performs the synthetic export by:
153+
154+
1. Invoking the **Get** operation on the resource to retrieve the actual state of the instance.
155+
156+
Unlike non-synthetic export operations, users _must_ provide a filter for the resource if the
157+
resource instance JSON schema defines any [required properties][19].
158+
1. Exporting an instance of the resource with:
159+
160+
- The `properties` field populated by the actual state returned by the **Get** operation.
161+
- The `name` field populated by a string with the format `<short-type-name>-0`. The
162+
`<short-type-name>` is the last segment of the resource type name, like `Registry` for
163+
`Microsoft.Windows/Registry`.
164+
165+
Synthetic export only ever returns a single instance and always requires a filtering instance. You
166+
can use resources that rely on synthetic exporting with the following commands:
167+
168+
- [dsc config export][15] to return a configuration document representing the actual state for
169+
every instance of each resource defined in the input document. For resources that rely on
170+
synthetic export, you _must_ define a filtering instance in the input document. The resource
171+
can only export a single instance per filtering instance.
172+
- [dsc resource export][16] to return a configuration document representing the actual state for
173+
the required filtering instance. If you invoke this command without providing a filtering
174+
instance, the operation fails.
175+
149176
## resolve
150177

151178
A resource with the `resolve` capability supports resolving nested resource instances from an
152-
external source. This capability is primarily used by [importer resources][19] to enable users to
179+
external source. This capability is primarily used by [importer resources][20] to enable users to
153180
compose configuration documents.
154181

155-
A command resource has this capability when it defines the [resolve][20] property in its resource
182+
A command resource has this capability when it defines the [resolve][21] property in its resource
156183
manifest.
157184

158185
## See also
159186

160-
- [DSC resource operations][21]
161-
- [DSC resource kinds][22]
162-
- [DSC resource properties][23]
187+
- [DSC resource operations][22]
188+
- [DSC resource kinds][23]
189+
- [DSC resource properties][24]
163190

164191
<!-- Link reference definitions -->
165192
[01]: operations.md#get-operation
@@ -180,8 +207,9 @@ manifest.
180207
[16]: ../../reference/cli/resource/export.md
181208
[17]: ../../reference/cli/resource/get.md#--all
182209
[18]: ../../reference/schemas/resource/manifest/export.md
183-
[19]: ../resources/kinds.md#importer-resources
184-
[20]: ../../reference/schemas/resource/manifest/resolve.md
185-
[21]: operations.md
186-
[22]: kinds.md
187-
[23]: ../../concepts/resources/properties.md
210+
[19]: ./properties.md#required-resource-properties
211+
[20]: ../resources/kinds.md#importer-resources
212+
[21]: ../../reference/schemas/resource/manifest/resolve.md
213+
[22]: operations.md
214+
[23]: kinds.md
215+
[24]: ../../concepts/resources/properties.md

docs/concepts/resources/operations.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ DSC invokes the **Delete** operation when you use the following commands:
6767
The **Export** operation retrieves the actual state for every instance of the resource on a system.
6868
The result is a configuration document that includes the exported instances.
6969

70-
This operation is only available for resources with the [export capability][05].
70+
If a resource doesn't have the [`export` capability][05], DSC synthetically exports the resource.
71+
For more information, see [Synthetic export][06].
7172

7273
DSC invokes the **Export** operation when you use the following commands:
7374

@@ -83,7 +84,7 @@ DSC invokes the **Export** operation when you use the following commands:
8384
The **List** operation retrieves the available adapted resources for a specific DSC adapter
8485
resource.
8586

86-
This operation is only available for [adapter resources][06].
87+
This operation is only available for [adapter resources][07].
8788

8889
## Validate operation
8990

@@ -101,26 +102,27 @@ invoke an adapted resource.
101102
The **Resolve** operation processes an importer resource instance to return a configuration
102103
document.
103104

104-
This operation is only available for resources with the [resolve capability][07]. This operation
105-
is primarily useful for [importer resources][08].
105+
This operation is only available for resources with the [resolve capability][08]. This operation
106+
is primarily useful for [importer resources][09].
106107

107108
## See also
108109

109-
- [DSC resource capabilities][09]
110-
- [DSC resource kinds][10]
111-
- [DSC resource properties][11]
112-
- [DSC command reference][12]
110+
- [DSC resource capabilities][10]
111+
- [DSC resource kinds][11]
112+
- [DSC resource properties][12]
113+
- [DSC command reference][13]
113114

114115
<!-- Link reference definitions -->
115116
[01]: ./capabilities.md#get
116117
[02]: ./capabilities.md#test
117118
[03]: ./capabilities.md#set
118119
[04]: ./capabilities.md#delete
119120
[05]: ./capabilities.md#export
120-
[06]: ./kinds.md#adapter-resources
121-
[07]: ./capabilities.md#resolve
122-
[08]: ./kinds.md#importer-resources
123-
[09]: ./capabilities.md
124-
[10]: ./kinds.md
125-
[11]: ./properties.md
126-
[12]: ../../reference/cli/index.md
121+
[06]: ./capabilities.md#synthetic-export
122+
[07]: ./kinds.md#adapter-resources
123+
[08]: ./capabilities.md#resolve
124+
[09]: ./kinds.md#importer-resources
125+
[10]: ./capabilities.md
126+
[11]: ./kinds.md
127+
[12]: ./properties.md
128+
[13]: ../../reference/cli/index.md

docs/concepts/resources/overview.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,12 @@ Use the `dsc resource export` command to invoke the operation. When you invoke t
264264
operation, DSC returns an array of resources instance definitions you can copy into a configuration
265265
document.
266266

267+
You can specify an input instance for the **Export** operation to filter the exported instances. If
268+
a resource doesn't implement **Export**, you can still invoke the `dsc resource export` command.
269+
When you invoke the **Export** operation for a resource that doesn't implement **Export**, DSC
270+
provides a _synthetic export_. When using DSC's synthetic export feature, you must provide a
271+
filtering instance of the resource. For more information, see [Synthetic export][04].
272+
267273
## Declaring resource instances
268274

269275
DSC configuration documents enable managing more than one resource or resource instance at a time.
@@ -298,14 +304,15 @@ resources:
298304

299305
## See also
300306

301-
- [Anatomy of a DSC command resource][04] to learn about authoring resources in your language
307+
- [Anatomy of a DSC command resource][05] to learn about authoring resources in your language
302308
of choice.
303-
- [DSC configuration documents][05] to learn about using resources in a configuration document.
304-
- [Command line reference for the 'dsc resource' command][06]
309+
- [DSC configuration documents][06] to learn about using resources in a configuration document.
310+
- [Command line reference for the 'dsc resource' command][07]
305311

306312
[01]: ../../reference/schemas/definitions/resourceType.md
307313
[02]: ../../reference/schemas/resource/properties/overview.md
308314
[03]: ../../reference/cli/resource/list.md
309-
[04]: ./anatomy.md
310-
[05]: ../configuration-documents/overview.md
311-
[06]: ../../reference/cli/resource/index.md
315+
[04]: capabilities.md#synthetic-export
316+
[05]: ./anatomy.md
317+
[06]: ../configuration-documents/overview.md
318+
[07]: ../../reference/cli/resource/index.md

0 commit comments

Comments
 (0)