Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dsc/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ pub enum ConfigSubCommand {
file: Option<String>,
#[clap(short = 'o', long, help = t!("args.outputFormat").to_string())]
output_format: Option<OutputFormat>,
#[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())]
Expand Down
10 changes: 8 additions & 2 deletions dsc/tests/dsc_whatif.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 <alias>' -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:
Expand All @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion dsc_lib/src/functions/create_object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl Function for CreateObject {
fn invoke(&self, args: &[Value], _context: &Context) -> Result<Value, DscError> {
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()));
}

Expand Down
12 changes: 0 additions & 12 deletions dscecho/src/echo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading