Skip to content

Commit d577b3c

Browse files
(SCHEMAS) Regenerate 2024/04 schemas
This change regenerates the canonical schemas from the updated source definitions.
1 parent 0067f7c commit d577b3c

File tree

16 files changed

+460
-81
lines changed

16 files changed

+460
-81
lines changed

CHANGELOG.md

+163
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,161 @@ changes since the last release, see the [diff on GitHub][unreleased].
7070
for the `v3.0.0.0-alpha.5` release. Leave the release links under the release section.
7171
-->
7272

73+
### Added
74+
75+
- Added the [`--what-if` (`-w`)][ur-aa] option to the [dsc config set][cmd-cset] command. When you
76+
call `dsc config set` with the `--what-if` option, DSC doesn't actually invoke the resources to
77+
enforce the desired state. Instead, it returns the expected output for the command, showing the
78+
before and after state for each resource instance.
79+
80+
The output for the `dsc config set` operation with the `--what-if` operation is the same as an
81+
[actual configuration set operation][ur-ab], except that the metadata field
82+
[executionType][ur-ac] is set to `WhatIf` instead of `Actual`.
83+
84+
In this release, the generated output is synthetic, based on the results of the resources' `test`
85+
operation. In the future, resources will be able to participate in what-if operations, reporting
86+
more specifically how they will change the system. For example, participating resources could
87+
indicate whether an actual set operation will require a reboot or whether the current user has
88+
the correct permissions to manage that resource instance.
89+
90+
<details><summary>Related work items</summary>
91+
92+
- Issues: [#70][#70]
93+
- PRs: [#400][#400]
94+
95+
</details>
96+
97+
- Added support for [importer resources][ur-ad]. These resources resolve external sources to a
98+
nested DSC Configuration document. The resolved instances are processed as nested resource
99+
instances.
100+
101+
This required some updates to the schemas, all backwards-compatible:
102+
103+
- Added a new [resourceKind][ur-ae] named `Import`.
104+
- Added the [resolve][ur-af] command to resource manifests.
105+
- Added the new [`Resolve`][ur-ag] capability, returned in the output for the
106+
[dsc resource list][cmd-rlist] command when DSC discovers an importer resource.
107+
108+
<details><summary>Related work items</summary>
109+
110+
- Issues: [#429][#429]
111+
- PRs: [#412][#412]
112+
113+
</details>
114+
115+
- Added the `Microsoft.DSC/Include` importer resource to resolve instances from an external
116+
configuration document. The resolved instances are processed as nested instances for the
117+
`Microsoft.DSC/Include` resource instance.
118+
119+
You can use this resource to write smaller configuration documents and compose them as needed.
120+
For example, you could define a security baseline and a web server configuration separately, then
121+
combine them for a given application:
122+
123+
```yaml
124+
$schema: &schema https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
125+
resources:
126+
# Group of included baseline configurations
127+
- name: Baselines
128+
type: Microsoft.DSC/Group
129+
properties:
130+
$schema: *schema
131+
resources:
132+
- name: Security Baseline
133+
type: Microsoft.DSC/Include
134+
properties:
135+
configurationFile: security_baseline.dsc.yaml
136+
parametersFile: security_baseline.parameters.yaml
137+
- name: Web Server Baseline
138+
type: Microsoft.DSC/Include
139+
properties:
140+
configurationFile: web_baseline.dsc.yaml
141+
parametersFile: web_baseline.parameters.yaml
142+
dependsOn:
143+
- "[resourceId('Microsoft.DSC/Include', 'Security Baseline')]"
144+
145+
# application configuration instances, all depend on the baselines
146+
- name: Application configuration
147+
type: MyApp/Settings
148+
properties:
149+
someSetting: someValue
150+
dependsOn:
151+
- "[resourceId('Microsoft.DSC/Group', 'Baselines')]"
152+
```
153+
154+
<details><summary>Related work items</summary>
155+
156+
- Issues: [#429][#429]
157+
- PRs: [#412][#412]
158+
159+
</details>
160+
161+
- Added caching for PowerShell Desired State Configuration (PSDSC) resources when using the
162+
`Microsoft.DSC/PowerShell` and `Microsoft.Windows/PowerShell` adapters. The adapters use the
163+
cache to speed up resource discovery. The performance improvement reduced the resource list time
164+
under tests from eight seconds to two seconds, and reduced invocation operation times by half.
165+
166+
The adapters cache the resources in the following locations, depending on your platform:
167+
168+
| Adapter | Platform | Path |
169+
| :----------------------------: | :------: | :---------------------------------------------- |
170+
| `Microsoft.DSC/PowerShell` | Linux | `$HOME/.dsc/PSAdapterCache.json` |
171+
| `Microsoft.DSC/PowerShell` | macOS | `$HOME/.dsc/PSAdapterCache.json` |
172+
| `Microsoft.DSC/PowerShell` | Windows | `%LOCALAPPDATA%\dsc\PSAdapterCache.json` |
173+
| `Microsoft.Windows/PowerShell` | Windows | `%LOCALAPPDATA%\dsc\WindowsPSAdapterCache.json` |
174+
175+
The adapters check whether the cache is stale on each run and refresh it if:
176+
177+
- The `PSModulePath` environmental variable is updated.
178+
- Any module is added or removed from the `PSModulePath`.
179+
- Any related files in a cached PSDSC resource module has been updated since the cache was
180+
written. The adapter watches the `LastWriteTime` of module files with the following extensions:
181+
`.ps1`, `.psd1`, `.psm1`, and `.mof`.
182+
183+
<details><summary>Related work items</summary>
184+
185+
- Issues: [#371][#371]
186+
- PRs: [#432][#432]
187+
188+
</details>
189+
190+
- Added the `DSC.PackageManagement/Apt` resource for managing software on systems that use the
191+
advanced package tool (APT). In this release, you can use the resource to:
192+
193+
- Install the latest version of a package.
194+
- Uninstall a package.
195+
- Get the current state of a package.
196+
- Export every installed package as a DSC resource instance.
197+
198+
<details><summary>Related work items</summary>
199+
200+
- Issues: _None_.
201+
- PRs: [#434][#434]
202+
203+
</details>
204+
205+
206+
### Fixed
207+
208+
- Fixed the JSON Schema for [exit codes][ur-fa] in the resource manifest to support negative
209+
integers. Prior to this release, the DSC engine supported negative exit codes but the JSON Schema
210+
forbid them.
211+
212+
<details><summary>Related work items</summary>
213+
214+
- Issues: [#407][#407]
215+
- PRs: [#410][#410]
216+
217+
</details>
218+
73219
<!-- Unreleased change links -->
220+
[ur-aa]: ./docs/reference/cli/config/set.md#-w---what-if
221+
[ur-ab]: ./docs/reference/schemas/outputs/config/set.md
222+
[ur-ac]: ./docs/reference/schemas/metadata/Microsoft.DSC/properties.md#executiontype
223+
[ur-ad]: ./docs/reference/schemas/definitions/resourceKind.md#importer-resources
224+
[ur-ae]: ./docs/reference/schemas/definitions/resourceKind.md
225+
[ur-af]: ./docs/reference/schemas/resource/manifest/resolve.md
226+
[ur-ag]: ./docs/reference/schemas/outputs/resource/list.md#capability-resolve
227+
[ur-fa]: ./docs/reference/schemas/resource/manifest/root.md#exitcodes
74228

75229
## [v3.0.0-preview.7][release-v3.0.0-preview.7] - 2024-04-22
76230

@@ -1318,6 +1472,7 @@ For the full list of changes in this release, see the [diff on GitHub][compare-v
13181472
[#362]: https://github.com/PowerShell/DSC/issues/362
13191473
[#364]: https://github.com/PowerShell/DSC/issues/364
13201474
[#368]: https://github.com/PowerShell/DSC/issues/368
1475+
[#371]: https://github.com/PowerShell/DSC/issues/371
13211476
[#373]: https://github.com/PowerShell/DSC/issues/373
13221477
[#375]: https://github.com/PowerShell/DSC/issues/375
13231478
[#376]: https://github.com/PowerShell/DSC/issues/376
@@ -1327,11 +1482,19 @@ For the full list of changes in this release, see the [diff on GitHub][compare-v
13271482
[#385]: https://github.com/PowerShell/DSC/issues/385
13281483
[#388]: https://github.com/PowerShell/DSC/issues/388
13291484
[#397]: https://github.com/PowerShell/DSC/issues/397
1485+
[#400]: https://github.com/PowerShell/DSC/issues/400
13301486
[#401]: https://github.com/PowerShell/DSC/issues/401
13311487
[#405]: https://github.com/PowerShell/DSC/issues/405
1488+
[#407]: https://github.com/PowerShell/DSC/issues/407
1489+
[#410]: https://github.com/PowerShell/DSC/issues/410
1490+
[#412]: https://github.com/PowerShell/DSC/issues/412
1491+
[#429]: https://github.com/PowerShell/DSC/issues/429
1492+
[#432]: https://github.com/PowerShell/DSC/issues/432
1493+
[#434]: https://github.com/PowerShell/DSC/issues/434
13321494
[#45]: https://github.com/PowerShell/DSC/issues/45
13331495
[#49]: https://github.com/PowerShell/DSC/issues/49
13341496
[#57]: https://github.com/PowerShell/DSC/issues/57
1497+
[#70]: https://github.com/PowerShell/DSC/issues/70
13351498
[#73]: https://github.com/PowerShell/DSC/issues/73
13361499
[#75]: https://github.com/PowerShell/DSC/issues/75
13371500
[#89]: https://github.com/PowerShell/DSC/issues/89

docs/reference/cli/config/set.md

+14
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,20 @@ Type: String
125125
Mandatory: false
126126
```
127127

128+
### -w, --what-if
129+
130+
When you specify this flag option, DSC doesn't actually change the system state with the `set`
131+
operation. Instead, it returns output indicating _how_ the operation will change system state when
132+
called without this option. Use this option to preview the changes DSC will make to a system.
133+
134+
The output for the command when you use this option is the same as without, except that the
135+
`ExecutionType` metadata field is set to `WhatIf` instead of `Actual`.
136+
137+
```yaml
138+
Type: Boolean
139+
Mandatory: false
140+
```
141+
128142
### -f, --format
129143

130144
The `--format` option controls the console output format for the command. If the command output is

docs/reference/cli/dsc.md

+5
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,11 @@ execution of the command.
162162
| `5` | The command failed because a resource definition or instance value was invalid against its JSON schema. |
163163
| `6` | The command was cancelled by a <kbd>Ctrl</kbd>+<kbd>C</kbd> interruption. |
164164

165+
## Notes
166+
167+
DSC expects input strings to use UTF-8 encoding. When you pass input from stdin or the path to a
168+
file, ensure that the input is encoded as UTF-8.
169+
165170
[01]: completer/command.md
166171
[02]: config/command.md
167172
[03]: resource/command.md

0 commit comments

Comments
 (0)