From f3a3454512064adec36cad701de2f780b826f013 Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Fri, 15 Sep 2023 20:12:10 -0700 Subject: [PATCH 1/3] fix usability issues --- dsc/assertion.dsc.resource.json | 2 +- dsc/group.dsc.resource.json | 2 +- dsc/parallel.dsc.resource.json | 2 +- dsc/src/resource_command.rs | 7 +- dsc/src/subcommand.rs | 2 +- dsc/tests/dsc_set.tests.ps1 | 90 ++++++++++++++++--- dsc_lib/src/configure/mod.rs | 22 ++--- dsc_lib/src/dscresources/command_resource.rs | 29 +++--- dsc_lib/src/dscresources/dscresource.rs | 7 +- dsc_lib/src/dscresources/resource_manifest.rs | 2 +- dsc_lib/src/lib.rs | 51 +++++------ .../powershellgroup.dsc.resource.json | 2 +- process/process.dsc.resource.json | 2 +- registry/registry.dsc.resource.json | 2 +- .../08/bundled/outputs/resource/list.json | 6 +- .../2023/08/bundled/resource/manifest.json | 6 +- .../08/bundled/resource/manifest.vscode.json | 8 +- schemas/2023/08/resource/manifest.set.json | 6 +- schemas/examples/foo.dsc.resource.json | 2 +- 19 files changed, 162 insertions(+), 88 deletions(-) diff --git a/dsc/assertion.dsc.resource.json b/dsc/assertion.dsc.resource.json index 1dec02bd4..148938a6a 100644 --- a/dsc/assertion.dsc.resource.json +++ b/dsc/assertion.dsc.resource.json @@ -18,7 +18,7 @@ "test" ], "input": "stdin", - "preTest": true, + "implementsPreTest": true, "return": "state" }, "test": { diff --git a/dsc/group.dsc.resource.json b/dsc/group.dsc.resource.json index 056edbc0b..5c57118b7 100644 --- a/dsc/group.dsc.resource.json +++ b/dsc/group.dsc.resource.json @@ -18,7 +18,7 @@ "set" ], "input": "stdin", - "preTest": true, + "implementsPreTest": true, "return": "state" }, "test": { diff --git a/dsc/parallel.dsc.resource.json b/dsc/parallel.dsc.resource.json index 3522d5630..b1a8084c2 100644 --- a/dsc/parallel.dsc.resource.json +++ b/dsc/parallel.dsc.resource.json @@ -20,7 +20,7 @@ "set" ], "input": "stdin", - "preTest": true, + "implementsPreTest": true, "return": "state" }, "test": { diff --git a/dsc/src/resource_command.rs b/dsc/src/resource_command.rs index 4a6305965..073368bd2 100644 --- a/dsc/src/resource_command.rs +++ b/dsc/src/resource_command.rs @@ -74,6 +74,11 @@ pub fn get_all(dsc: &mut DscManager, resource: &str, _input: &Option, _s pub fn set(dsc: &mut DscManager, resource: &str, input: &Option, stdin: &Option, format: &Option) { let mut input = get_input(input, stdin); + if input.is_empty() { + eprintln!("Error: Input is empty"); + exit(EXIT_INVALID_ARGS); + } + let mut resource = get_resource(dsc, resource); //TODO: add to debug stream: println!("handle_resource_set - {} implemented_as - {:?}", resource.type_name, resource.implemented_as); @@ -85,7 +90,7 @@ pub fn set(dsc: &mut DscManager, resource: &str, input: &Option, stdin: //TODO: add to debug stream: println!("handle_resource_get - input - {}", input); - match resource.set(input.as_str()) { + match resource.set(input.as_str(), true) { Ok(result) => { // convert to json let json = match serde_json::to_string(&result) { diff --git a/dsc/src/subcommand.rs b/dsc/src/subcommand.rs index ebf22d231..2b8c1aa27 100644 --- a/dsc/src/subcommand.rs +++ b/dsc/src/subcommand.rs @@ -42,7 +42,7 @@ pub fn config_get(configurator: &Configurator, format: &Option) pub fn config_set(configurator: &Configurator, format: &Option) { - match configurator.invoke_set(ErrorAction::Continue, || { /* code */ }) { + match configurator.invoke_set(false, ErrorAction::Continue, || { /* code */ }) { Ok(result) => { let json = match serde_json::to_string(&result) { Ok(json) => json, diff --git a/dsc/tests/dsc_set.tests.ps1 b/dsc/tests/dsc_set.tests.ps1 index 7ed22ba1c..16ba4824d 100644 --- a/dsc/tests/dsc_set.tests.ps1 +++ b/dsc/tests/dsc_set.tests.ps1 @@ -3,23 +3,27 @@ Describe 'config set tests' { BeforeEach { - $json = @' - { - "keyPath": "HKCU\\1\\2\\3", - "_ensure": "Absent" - } + if ($IsWindows) { + $json = @' + { + "keyPath": "HKCU\\1\\2\\3", + "_ensure": "Absent" + } '@ - $json | registry config set + $json | registry config set + } } AfterEach { - $json = @' - { - "keyPath": "HKCU\\1", - "_ensure": "Absent" - } + if ($IsWindows) { + $json = @' + { + "keyPath": "HKCU\\1", + "_ensure": "Absent" + } '@ - $json | registry config set + $json | registry config set + } } It 'can set and remove a registry value' -Skip:(!$IsWindows) { @@ -62,4 +66,66 @@ Describe 'config set tests' { $result.changedProperties | Should -Be @('keyPath') ($result.psobject.properties | Measure-Object).Count | Should -Be 3 } + + It 'set can be used on a resource that does not implement test' { + $manifest = @' + { + "manifestVersion": "1.0.0", + "type": "Test/SetNoTest", + "version": "0.1.0", + "get": { + "executable": "pwsh", + "args": [ + "-NoLogo", + "-NonInteractive", + "-NoProfile", + "-Command", + "'{ \"test\": true }'" + ] + }, + "set": { + "executable": "pwsh", + "input": "stdin", + "args": [ + "-NoLogo", + "-NonInteractive", + "-NoProfile", + "-Command", + "'{ \"test\": false }'" + ], + "return": "state" + }, + "schema": { + "embedded": { + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://test", + "title": "test", + "description": "test", + "type": "object", + "required": [], + "additionalProperties": false, + "properties": { + "test": { + "type": "boolean", + "description": "test" + } + } + } + } + } +'@ + + Set-Content -Path "$TestDrive/SetNoTest.dsc.resource.json" -Value $manifest + $oldPath = $env:DSC_RESOURCE_PATH + try { + $env:DSC_RESOURCE_PATH = $TestDrive + $out = '{ "test": true }' | dsc resource set -r Test/SetNoTest | ConvertFrom-Json + $LASTEXITCODE | Should -Be 0 + $out.BeforeState.test | Should -Be $true + $out.AfterState.test | Should -Be $false + } + finally { + $env:DSC_RESOURCE_PATH = $oldPath + } + } } diff --git a/dsc_lib/src/configure/mod.rs b/dsc_lib/src/configure/mod.rs index ce934e06c..3c49878d9 100644 --- a/dsc_lib/src/configure/mod.rs +++ b/dsc_lib/src/configure/mod.rs @@ -28,14 +28,14 @@ pub enum ErrorAction { } /// Add the results of an export operation to a configuration. -/// +/// /// # Arguments -/// +/// /// * `resource` - The resource to export. /// * `conf` - The configuration to add the results to. /// /// # Errors -/// +/// /// This function will return an error if the underlying resource fails. pub fn add_resource_export_results_to_configuration(resource: &DscResource, conf: &mut Configuration) -> Result<(), DscError> { let export_result = resource.export()?; @@ -119,7 +119,7 @@ impl Configurator { /// # Errors /// /// This function will return an error if the underlying resource fails. - pub fn invoke_set(&self, _error_action: ErrorAction, _progress_callback: impl Fn() + 'static) -> Result { + pub fn invoke_set(&self, skip_test: bool, _error_action: ErrorAction, _progress_callback: impl Fn() + 'static) -> Result { let (config, messages, had_errors) = self.validate_config()?; let mut result = ConfigurationSetResult::new(); result.messages = messages; @@ -133,7 +133,7 @@ impl Configurator { }; //TODO: add to debug stream:println!("{}", &resource.resource_type); let desired = serde_json::to_string(&resource.properties)?; - let set_result = dsc_resource.set(&desired)?; + let set_result = dsc_resource.set(&desired, skip_test)?; let resource_result = config_result::ResourceSetResult { name: resource.name.clone(), resource_type: resource.resource_type.clone(), @@ -203,18 +203,18 @@ impl Configurator { } /// Invoke the export operation on a configuration. - /// + /// /// # Arguments - /// + /// /// * `error_action` - The error action to use. /// * `progress_callback` - A callback to call when progress is made. - /// + /// /// # Returns - /// + /// /// * `ConfigurationExportResult` - The result of the export operation. - /// + /// /// # Errors - /// + /// /// This function will return an error if the underlying resource fails. pub fn invoke_export(&self, _error_action: ErrorAction, _progress_callback: impl Fn() + 'static) -> Result { let (config, messages, had_errors) = self.validate_config()?; diff --git a/dsc_lib/src/dscresources/command_resource.rs b/dsc_lib/src/dscresources/command_resource.rs index 26a61bc52..56403a27f 100644 --- a/dsc_lib/src/dscresources/command_resource.rs +++ b/dsc_lib/src/dscresources/command_resource.rs @@ -49,17 +49,18 @@ pub fn invoke_get(resource: &ResourceManifest, cwd: &str, filter: &str) -> Resul /// /// * `resource` - The resource manifest /// * `desired` - The desired state of the resource in JSON +/// * `skip_test` - If true, skip the test and directly invoke the set operation /// /// # Errors /// /// Error returned if the resource does not successfully set the desired state -pub fn invoke_set(resource: &ResourceManifest, cwd: &str, desired: &str) -> Result { +pub fn invoke_set(resource: &ResourceManifest, cwd: &str, desired: &str, skip_test: bool) -> Result { let Some(set) = resource.set.as_ref() else { return Err(DscError::NotImplemented("set".to_string())); }; verify_json(resource, cwd, desired)?; // if resource doesn't implement a pre-test, we execute test first to see if a set is needed - if !set.pre_test.unwrap_or_default() { + if !skip_test && !set.pre_test.unwrap_or_default() { let test_result = invoke_test(resource, cwd, desired)?; if test_result.in_desired_state { return Ok(SetResult { @@ -201,19 +202,19 @@ pub fn invoke_test(resource: &ResourceManifest, cwd: &str, expected: &str) -> Re } /// Invoke the validate operation against a command resource. -/// +/// /// # Arguments -/// +/// /// * `resource` - The resource manifest for the command resource. /// * `cwd` - The current working directory. /// * `config` - The configuration to validate in JSON. -/// +/// /// # Returns -/// +/// /// * `ValidateResult` - The result of the validate operation. -/// +/// /// # Errors -/// +/// /// Error is returned if the underlying command returns a non-zero exit code. pub fn invoke_validate(resource: &ResourceManifest, cwd: &str, config: &str) -> Result { // TODO: use schema to validate config if validate is not implemented @@ -271,18 +272,18 @@ pub fn get_schema(resource: &ResourceManifest, cwd: &str) -> Result Result { diff --git a/dsc_lib/src/dscresources/dscresource.rs b/dsc_lib/src/dscresources/dscresource.rs index b06138f60..5aacadecf 100644 --- a/dsc_lib/src/dscresources/dscresource.rs +++ b/dsc_lib/src/dscresources/dscresource.rs @@ -86,11 +86,12 @@ pub trait Invoke { /// # Arguments /// /// * `desired` - The desired state as JSON to apply to the resource. + /// * `skip_test` - Whether to skip the test operation. /// /// # Errors /// /// This function will return an error if the underlying resource fails. - fn set(&self, desired: &str) -> Result; + fn set(&self, desired: &str, skip_test: bool) -> Result; /// Invoke the test operation on the resource. /// @@ -145,7 +146,7 @@ impl Invoke for DscResource { } } - fn set(&self, desired: &str) -> Result { + fn set(&self, desired: &str, skip_test: bool) -> Result { match &self.implemented_as { ImplementedAs::Custom(_custom) => { Err(DscError::NotImplemented("set custom resources".to_string())) @@ -155,7 +156,7 @@ impl Invoke for DscResource { return Err(DscError::MissingManifest(self.type_name.clone())); }; let resource_manifest = serde_json::from_value::(manifest.clone())?; - command_resource::invoke_set(&resource_manifest, &self.directory, desired) + command_resource::invoke_set(&resource_manifest, &self.directory, desired, skip_test) }, } } diff --git a/dsc_lib/src/dscresources/resource_manifest.rs b/dsc_lib/src/dscresources/resource_manifest.rs index 5f97f0251..9ab6fa8cf 100644 --- a/dsc_lib/src/dscresources/resource_manifest.rs +++ b/dsc_lib/src/dscresources/resource_manifest.rs @@ -107,7 +107,7 @@ pub struct SetMethod { /// How to pass required input for a Set. pub input: InputKind, /// Whether to run the Test method before the Set method. True means the resource will perform its own test before running the Set method. - #[serde(rename = "preTest", skip_serializing_if = "Option::is_none")] + #[serde(rename = "implementsPreTest", skip_serializing_if = "Option::is_none")] pub pre_test: Option, /// The type of return value expected from the Set method. #[serde(rename = "return", skip_serializing_if = "Option::is_none")] diff --git a/dsc_lib/src/lib.rs b/dsc_lib/src/lib.rs index dd67fd1a6..b9b5a525c 100644 --- a/dsc_lib/src/lib.rs +++ b/dsc_lib/src/lib.rs @@ -16,11 +16,11 @@ pub struct DscManager { impl DscManager { /// Create a new `DscManager` instance. - /// + /// /// # Errors - /// + /// /// This function will return an error if the underlying discovery fails. - /// + /// pub fn new() -> Result { Ok(Self { discovery: discovery::Discovery::new()?, @@ -30,65 +30,66 @@ impl DscManager { /// Initialize the discovery process. /// /// # Errors - /// + /// /// This function will return an error if the underlying discovery fails. - /// + /// pub fn initialize_discovery(&mut self) -> Result<(), DscError> { self.discovery.initialize() } /// Find a resource by name. - /// + /// /// # Arguments - /// + /// /// * `name` - The name of the resource to find, can have wildcards. - /// + /// #[must_use] pub fn find_resource(&self, name: &str) -> ResourceIterator { self.discovery.find_resource(name) } /// Invoke the get operation on a resource. - /// + /// /// # Arguments - /// + /// /// * `resource` - The resource to invoke the operation on. /// * `input` - The input to the operation. - /// + /// /// # Errors - /// + /// /// This function will return an error if the underlying resource fails. - /// + /// pub fn resource_get(&self, resource: &DscResource, input: &str) -> Result { resource.get(input) } /// Invoke the set operation on a resource. - /// + /// /// # Arguments - /// + /// /// * `resource` - The resource to invoke the operation on. /// * `input` - The input to the operation. - /// + /// * `skip_test` - Whether to skip the test operation. + /// /// # Errors - /// + /// /// This function will return an error if the underlying resource fails. - /// - pub fn resource_set(&self, resource: &DscResource, input: &str) -> Result { - resource.set(input) + /// + pub fn resource_set(&self, resource: &DscResource, input: &str, skip_test: bool) -> Result { + resource.set(input, skip_test) } /// Invoke the test operation on a resource. - /// + /// /// # Arguments - /// + /// /// * `resource` - The resource to invoke the operation on. /// * `input` - The input to the operation. - /// + /// /// # Errors - /// + /// /// This function will return an error if the underlying resource fails. - /// + /// pub fn resource_test(&self, resource: &DscResource, input: &str) -> Result { resource.test(input) } diff --git a/powershellgroup/powershellgroup.dsc.resource.json b/powershellgroup/powershellgroup.dsc.resource.json index bdf08cf18..698414c39 100644 --- a/powershellgroup/powershellgroup.dsc.resource.json +++ b/powershellgroup/powershellgroup.dsc.resource.json @@ -39,7 +39,7 @@ "$Input | ./powershellgroup.resource.ps1 Set" ], "input": "stdin", - "preTest": true, + "implementsPreTest": true, "return": "state" }, "test": { diff --git a/process/process.dsc.resource.json b/process/process.dsc.resource.json index e5391cc23..66afcae85 100644 --- a/process/process.dsc.resource.json +++ b/process/process.dsc.resource.json @@ -15,7 +15,7 @@ "set" ], "input": "stdin", - "preTest": false, + "implementsPreTest": false, "return": "state" }, "test": { diff --git a/registry/registry.dsc.resource.json b/registry/registry.dsc.resource.json index 70995932b..36591f55d 100644 --- a/registry/registry.dsc.resource.json +++ b/registry/registry.dsc.resource.json @@ -22,7 +22,7 @@ "set" ], "input": "stdin", - "preTest": true, + "implementsPreTest": true, "return": "state" }, "test": { diff --git a/schemas/2023/08/bundled/outputs/resource/list.json b/schemas/2023/08/bundled/outputs/resource/list.json index 2d8301209..5992e0a7f 100644 --- a/schemas/2023/08/bundled/outputs/resource/list.json +++ b/schemas/2023/08/bundled/outputs/resource/list.json @@ -259,7 +259,7 @@ "input": { "$ref": "/PowerShell/DSC/main/schemas/2023/08/definitions/inputKind.json" }, - "preTest": { + "implementsPreTest": { "title": "Resource Performs Pre-Test", "description": "Defines whether the DSC Resource performs its own test to ensure idempotency when calling the `set` command. Set this value to `true` if the DSC Resource tests input before modifying system state.", "type": "boolean", @@ -277,7 +277,7 @@ "set" ], "input": "stdin", - "preTest": true, + "implementsPreTest": true, "return": "state" } }, @@ -662,4 +662,4 @@ "readOnly": true } } -} +} diff --git a/schemas/2023/08/bundled/resource/manifest.json b/schemas/2023/08/bundled/resource/manifest.json index edcbb7e05..5614c8fb2 100644 --- a/schemas/2023/08/bundled/resource/manifest.json +++ b/schemas/2023/08/bundled/resource/manifest.json @@ -172,7 +172,7 @@ "input": { "$ref": "/PowerShell/DSC/main/schemas/2023/08/definitions/inputKind.json" }, - "preTest": { + "implementsPreTest": { "title": "Resource Performs Pre-Test", "description": "Defines whether the DSC Resource performs its own test to ensure idempotency when calling the `set` command. Set this value to `true` if the DSC Resource tests input before modifying system state.", "type": "boolean", @@ -190,7 +190,7 @@ "set" ], "input": "stdin", - "preTest": true, + "implementsPreTest": true, "return": "state" } }, @@ -575,4 +575,4 @@ "readOnly": true } } -} +} diff --git a/schemas/2023/08/bundled/resource/manifest.vscode.json b/schemas/2023/08/bundled/resource/manifest.vscode.json index 6fd780114..c48b49de1 100644 --- a/schemas/2023/08/bundled/resource/manifest.vscode.json +++ b/schemas/2023/08/bundled/resource/manifest.vscode.json @@ -255,12 +255,12 @@ "input": { "$ref": "#/$defs/PowerShell/DSC/main/schemas/2023/08/definitions/inputKind.json" }, - "preTest": { + "implementsPreTest": { "title": "Resource Performs Pre-Test", "description": "Defines whether the DSC Resource performs its own test to ensure idempotency when calling the `set` command. Set this value to `true` if the DSC Resource tests input before modifying system state.", "type": "boolean", "default": false, - "markdownDescription": "> [Online Documentation][01]\n\nDefines whether the DSC Resource performs its own test to ensure idempotency when calling the\n`set` command. Set this value to `true` if the DSC Resource tests input before modifying\nsystem state.\n\n[01]: https://learn.microsoft.com/powershell/dsc/reference/schemas/resource/manifest/set?view=dsc-3.0&preserveView=true#pretest\n" + "markdownDescription": "> [Online Documentation][01]\n\nDefines whether the DSC Resource performs its own test to ensure idempotency when calling the\n`set` command. Set this value to `true` if the DSC Resource tests input before modifying\nsystem state.\n\n[01]: https://learn.microsoft.com/powershell/dsc/reference/schemas/resource/manifest/set?view=dsc-3.0&preserveView=true#implementsPreTest\n" }, "return": { "description": "Defines whether the command returns a JSON blob of the DSC Resource's state after the set operation or the state and an array of the properties the DSC Resource modified.", @@ -280,7 +280,7 @@ "set" ], "input": "stdin", - "preTest": true, + "implementsPreTest": true, "return": "state" } ] @@ -637,4 +637,4 @@ } } } -} +} diff --git a/schemas/2023/08/resource/manifest.set.json b/schemas/2023/08/resource/manifest.set.json index 0c2a5fddb..87ea0d83c 100644 --- a/schemas/2023/08/resource/manifest.set.json +++ b/schemas/2023/08/resource/manifest.set.json @@ -18,7 +18,7 @@ "input": { "$ref": "/PowerShell/DSC/main/schemas/2023/08/definitions/inputKind.json" }, - "preTest": { + "implementsPreTest": { "title": "Resource Performs Pre-Test", "description": "Defines whether the DSC Resource performs its own test to ensure idempotency when calling the `set` command. Set this value to `true` if the DSC Resource tests input before modifying system state.", "type": "boolean", @@ -36,7 +36,7 @@ "set" ], "input": "stdin", - "preTest": true, + "implementsPreTest": true, "return": "state" } -} +} diff --git a/schemas/examples/foo.dsc.resource.json b/schemas/examples/foo.dsc.resource.json index 7e05a300a..375768e10 100644 --- a/schemas/examples/foo.dsc.resource.json +++ b/schemas/examples/foo.dsc.resource.json @@ -20,7 +20,7 @@ "set" ], "input": "stdin", - "preTest": false, + "implementsPreTest": false, "return": "state" }, "schema": { From 13b45c35226f3eedce1ea0cea62665f27d90c666 Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Fri, 15 Sep 2023 20:13:54 -0700 Subject: [PATCH 2/3] fix clippy --- dsc/src/resource_command.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dsc/src/resource_command.rs b/dsc/src/resource_command.rs index 073368bd2..b64ec8813 100644 --- a/dsc/src/resource_command.rs +++ b/dsc/src/resource_command.rs @@ -20,7 +20,7 @@ pub fn get(dsc: &mut DscManager, resource: &str, input: &Option, stdin: //TODO: add to debug stream: println!("handle_resource_get - {} implemented_as - {:?}", resource.type_name, resource.implemented_as); if let Some(requires) = resource.requires { input = add_type_name_to_json(input, resource.type_name); - resource = get_resource(dsc, &requires.clone()); + resource = get_resource(dsc, &requires); } //TODO: add to debug stream: println!("handle_resource_get - input - {}", input); @@ -85,7 +85,7 @@ pub fn set(dsc: &mut DscManager, resource: &str, input: &Option, stdin: if let Some(requires) = resource.requires { input = add_type_name_to_json(input, resource.type_name); - resource = get_resource(dsc, &requires.clone()); + resource = get_resource(dsc, &requires); } //TODO: add to debug stream: println!("handle_resource_get - input - {}", input); @@ -117,7 +117,7 @@ pub fn test(dsc: &mut DscManager, resource: &str, input: &Option, stdin: if let Some(requires) = resource.requires { input = add_type_name_to_json(input, resource.type_name); - resource = get_resource(dsc, &requires.clone()); + resource = get_resource(dsc, &requires); } //TODO: add to debug stream: println!("handle_resource_test - input - {}", input); From 8d2eaaa3a236ec78373551f33e64b6753a1cff3f Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Fri, 15 Sep 2023 20:16:33 -0700 Subject: [PATCH 3/3] fix casing as `pretest` is a word --- dsc/assertion.dsc.resource.json | 2 +- dsc/group.dsc.resource.json | 2 +- dsc/parallel.dsc.resource.json | 2 +- dsc_lib/src/dscresources/resource_manifest.rs | 2 +- powershellgroup/powershellgroup.dsc.resource.json | 2 +- process/process.dsc.resource.json | 2 +- registry/registry.dsc.resource.json | 2 +- schemas/2023/08/bundled/outputs/resource/list.json | 4 ++-- schemas/2023/08/bundled/resource/manifest.json | 4 ++-- schemas/2023/08/bundled/resource/manifest.vscode.json | 6 +++--- schemas/2023/08/resource/manifest.set.json | 4 ++-- schemas/examples/foo.dsc.resource.json | 2 +- 12 files changed, 17 insertions(+), 17 deletions(-) diff --git a/dsc/assertion.dsc.resource.json b/dsc/assertion.dsc.resource.json index 148938a6a..1a8bec795 100644 --- a/dsc/assertion.dsc.resource.json +++ b/dsc/assertion.dsc.resource.json @@ -18,7 +18,7 @@ "test" ], "input": "stdin", - "implementsPreTest": true, + "implementsPretest": true, "return": "state" }, "test": { diff --git a/dsc/group.dsc.resource.json b/dsc/group.dsc.resource.json index 5c57118b7..d08d440c0 100644 --- a/dsc/group.dsc.resource.json +++ b/dsc/group.dsc.resource.json @@ -18,7 +18,7 @@ "set" ], "input": "stdin", - "implementsPreTest": true, + "implementsPretest": true, "return": "state" }, "test": { diff --git a/dsc/parallel.dsc.resource.json b/dsc/parallel.dsc.resource.json index b1a8084c2..8ee87872f 100644 --- a/dsc/parallel.dsc.resource.json +++ b/dsc/parallel.dsc.resource.json @@ -20,7 +20,7 @@ "set" ], "input": "stdin", - "implementsPreTest": true, + "implementsPretest": true, "return": "state" }, "test": { diff --git a/dsc_lib/src/dscresources/resource_manifest.rs b/dsc_lib/src/dscresources/resource_manifest.rs index 9ab6fa8cf..1ee852d61 100644 --- a/dsc_lib/src/dscresources/resource_manifest.rs +++ b/dsc_lib/src/dscresources/resource_manifest.rs @@ -107,7 +107,7 @@ pub struct SetMethod { /// How to pass required input for a Set. pub input: InputKind, /// Whether to run the Test method before the Set method. True means the resource will perform its own test before running the Set method. - #[serde(rename = "implementsPreTest", skip_serializing_if = "Option::is_none")] + #[serde(rename = "implementsPretest", skip_serializing_if = "Option::is_none")] pub pre_test: Option, /// The type of return value expected from the Set method. #[serde(rename = "return", skip_serializing_if = "Option::is_none")] diff --git a/powershellgroup/powershellgroup.dsc.resource.json b/powershellgroup/powershellgroup.dsc.resource.json index 698414c39..340197ec8 100644 --- a/powershellgroup/powershellgroup.dsc.resource.json +++ b/powershellgroup/powershellgroup.dsc.resource.json @@ -39,7 +39,7 @@ "$Input | ./powershellgroup.resource.ps1 Set" ], "input": "stdin", - "implementsPreTest": true, + "implementsPretest": true, "return": "state" }, "test": { diff --git a/process/process.dsc.resource.json b/process/process.dsc.resource.json index 66afcae85..ec0bad4e9 100644 --- a/process/process.dsc.resource.json +++ b/process/process.dsc.resource.json @@ -15,7 +15,7 @@ "set" ], "input": "stdin", - "implementsPreTest": false, + "implementsPretest": false, "return": "state" }, "test": { diff --git a/registry/registry.dsc.resource.json b/registry/registry.dsc.resource.json index 36591f55d..7d44462d8 100644 --- a/registry/registry.dsc.resource.json +++ b/registry/registry.dsc.resource.json @@ -22,7 +22,7 @@ "set" ], "input": "stdin", - "implementsPreTest": true, + "implementsPretest": true, "return": "state" }, "test": { diff --git a/schemas/2023/08/bundled/outputs/resource/list.json b/schemas/2023/08/bundled/outputs/resource/list.json index 5992e0a7f..85e977b7e 100644 --- a/schemas/2023/08/bundled/outputs/resource/list.json +++ b/schemas/2023/08/bundled/outputs/resource/list.json @@ -259,7 +259,7 @@ "input": { "$ref": "/PowerShell/DSC/main/schemas/2023/08/definitions/inputKind.json" }, - "implementsPreTest": { + "implementsPretest": { "title": "Resource Performs Pre-Test", "description": "Defines whether the DSC Resource performs its own test to ensure idempotency when calling the `set` command. Set this value to `true` if the DSC Resource tests input before modifying system state.", "type": "boolean", @@ -277,7 +277,7 @@ "set" ], "input": "stdin", - "implementsPreTest": true, + "implementsPretest": true, "return": "state" } }, diff --git a/schemas/2023/08/bundled/resource/manifest.json b/schemas/2023/08/bundled/resource/manifest.json index 5614c8fb2..a10db24b8 100644 --- a/schemas/2023/08/bundled/resource/manifest.json +++ b/schemas/2023/08/bundled/resource/manifest.json @@ -172,7 +172,7 @@ "input": { "$ref": "/PowerShell/DSC/main/schemas/2023/08/definitions/inputKind.json" }, - "implementsPreTest": { + "implementsPretest": { "title": "Resource Performs Pre-Test", "description": "Defines whether the DSC Resource performs its own test to ensure idempotency when calling the `set` command. Set this value to `true` if the DSC Resource tests input before modifying system state.", "type": "boolean", @@ -190,7 +190,7 @@ "set" ], "input": "stdin", - "implementsPreTest": true, + "implementsPretest": true, "return": "state" } }, diff --git a/schemas/2023/08/bundled/resource/manifest.vscode.json b/schemas/2023/08/bundled/resource/manifest.vscode.json index c48b49de1..ab0731d23 100644 --- a/schemas/2023/08/bundled/resource/manifest.vscode.json +++ b/schemas/2023/08/bundled/resource/manifest.vscode.json @@ -255,12 +255,12 @@ "input": { "$ref": "#/$defs/PowerShell/DSC/main/schemas/2023/08/definitions/inputKind.json" }, - "implementsPreTest": { + "implementsPretest": { "title": "Resource Performs Pre-Test", "description": "Defines whether the DSC Resource performs its own test to ensure idempotency when calling the `set` command. Set this value to `true` if the DSC Resource tests input before modifying system state.", "type": "boolean", "default": false, - "markdownDescription": "> [Online Documentation][01]\n\nDefines whether the DSC Resource performs its own test to ensure idempotency when calling the\n`set` command. Set this value to `true` if the DSC Resource tests input before modifying\nsystem state.\n\n[01]: https://learn.microsoft.com/powershell/dsc/reference/schemas/resource/manifest/set?view=dsc-3.0&preserveView=true#implementsPreTest\n" + "markdownDescription": "> [Online Documentation][01]\n\nDefines whether the DSC Resource performs its own test to ensure idempotency when calling the\n`set` command. Set this value to `true` if the DSC Resource tests input before modifying\nsystem state.\n\n[01]: https://learn.microsoft.com/powershell/dsc/reference/schemas/resource/manifest/set?view=dsc-3.0&preserveView=true#implementsPretest\n" }, "return": { "description": "Defines whether the command returns a JSON blob of the DSC Resource's state after the set operation or the state and an array of the properties the DSC Resource modified.", @@ -280,7 +280,7 @@ "set" ], "input": "stdin", - "implementsPreTest": true, + "implementsPretest": true, "return": "state" } ] diff --git a/schemas/2023/08/resource/manifest.set.json b/schemas/2023/08/resource/manifest.set.json index 87ea0d83c..aa39c13e7 100644 --- a/schemas/2023/08/resource/manifest.set.json +++ b/schemas/2023/08/resource/manifest.set.json @@ -18,7 +18,7 @@ "input": { "$ref": "/PowerShell/DSC/main/schemas/2023/08/definitions/inputKind.json" }, - "implementsPreTest": { + "implementsPretest": { "title": "Resource Performs Pre-Test", "description": "Defines whether the DSC Resource performs its own test to ensure idempotency when calling the `set` command. Set this value to `true` if the DSC Resource tests input before modifying system state.", "type": "boolean", @@ -36,7 +36,7 @@ "set" ], "input": "stdin", - "implementsPreTest": true, + "implementsPretest": true, "return": "state" } } diff --git a/schemas/examples/foo.dsc.resource.json b/schemas/examples/foo.dsc.resource.json index 375768e10..edef73b0f 100644 --- a/schemas/examples/foo.dsc.resource.json +++ b/schemas/examples/foo.dsc.resource.json @@ -20,7 +20,7 @@ "set" ], "input": "stdin", - "implementsPreTest": false, + "implementsPretest": false, "return": "state" }, "schema": {