From 272abb73bebfe0efdb5beb1f70cd1e40dd442439 Mon Sep 17 00:00:00 2001 From: Tess Gauthier Date: Thu, 18 Sep 2025 11:23:59 -0400 Subject: [PATCH 1/3] add aliases to --what-if --- dsc/src/args.rs | 2 +- dsc/tests/dsc_whatif.tests.ps1 | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/dsc/src/args.rs b/dsc/src/args.rs index a80111f3c..298136071 100644 --- a/dsc/src/args.rs +++ b/dsc/src/args.rs @@ -126,7 +126,7 @@ pub enum ConfigSubCommand { file: Option, #[clap(short = 'o', long, help = t!("args.outputFormat").to_string())] output_format: Option, - #[clap(short = 'w', long, help = t!("args.whatIf").to_string())] + #[clap(short = 'w', long, visible_aliases = ["dry-run", "noop"], help = t!("args.whatIf").to_string())] what_if: bool, }, #[clap(name = "test", about = t!("args.testAbout").to_string())] diff --git a/dsc/tests/dsc_whatif.tests.ps1 b/dsc/tests/dsc_whatif.tests.ps1 index aebc81544..4e2b13571 100644 --- a/dsc/tests/dsc_whatif.tests.ps1 +++ b/dsc/tests/dsc_whatif.tests.ps1 @@ -88,7 +88,13 @@ Describe 'whatif tests' { $LASTEXITCODE | Should -Be 0 } - It 'what-if execution of WhatIf resource' { + It 'what-if execution of WhatIf resource via ' -TestCases @( + @{ alias = '-w' } + @{ alias = '--what-if' } + @{ alias = '--dry-run' } + @{ alias = '--noop' } + ) { + param($alias) $config_yaml = @" `$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json resources: @@ -97,7 +103,7 @@ Describe 'whatif tests' { properties: executionType: Actual "@ - $result = $config_yaml | dsc config set -w -f - | ConvertFrom-Json + $result = $config_yaml | dsc config set $alias -f - | ConvertFrom-Json $result.metadata.'Microsoft.DSC'.executionType | Should -BeExactly 'whatIf' $result.results.result.afterState.executionType | Should -BeExactly 'WhatIf' $result.results.result.changedProperties | Should -BeExactly 'executionType' From 9369bae9033883919a7f468fc3b83182b28301a8 Mon Sep 17 00:00:00 2001 From: Tess Gauthier Date: Thu, 18 Sep 2025 11:53:10 -0400 Subject: [PATCH 2/3] fix clippy --- dsc_lib/src/functions/create_object.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dsc_lib/src/functions/create_object.rs b/dsc_lib/src/functions/create_object.rs index a15485840..9c1838b3b 100644 --- a/dsc_lib/src/functions/create_object.rs +++ b/dsc_lib/src/functions/create_object.rs @@ -35,7 +35,7 @@ impl Function for CreateObject { fn invoke(&self, args: &[Value], _context: &Context) -> Result { debug!("{}", t!("functions.createObject.invoked")); - if args.len() % 2 != 0 { + if !args.len().is_multiple_of(2) { return Err(DscError::Parser(t!("functions.createObject.argsMustBePairs").to_string())); } From e6925d22be16af508634b32808f6de8498fe1f8a Mon Sep 17 00:00:00 2001 From: Tess Gauthier Date: Thu, 18 Sep 2025 12:20:44 -0400 Subject: [PATCH 3/3] fix clippy again --- dscecho/src/echo.rs | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/dscecho/src/echo.rs b/dscecho/src/echo.rs index 10cf9612f..8485adb8b 100644 --- a/dscecho/src/echo.rs +++ b/dscecho/src/echo.rs @@ -5,18 +5,6 @@ use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use serde_json::Value; -#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, JsonSchema)] -pub struct SecureString { - #[serde(rename = "secureString")] - pub value: String, -} - -#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, JsonSchema)] -pub struct SecureObject { - #[serde(rename = "secureObject")] - pub value: Value, -} - #[derive(Debug, Clone, PartialEq, Deserialize, Serialize, JsonSchema)] #[serde(untagged)] pub enum Output {