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' 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())); } 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 {