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
16 changes: 16 additions & 0 deletions dsc/tests/dsc_config_get.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,20 @@ Describe 'dsc config get tests' {
$result.results[0].result.actualState.output | Should -Be 'hello'
$LASTEXITCODE | Should -Be 0
}

It 'no properties is supported' {
$config_yaml = @'
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
resources:
- name: OS
type: Microsoft/OSInfo
'@
$result = dsc config get -i $config_yaml | ConvertFrom-Json
$result.hadErrors | Should -BeFalse
$result.results.Count | Should -Be 1
$result.results[0].Name | Should -Be 'OS'
$result.results[0].type | Should -BeExactly 'Microsoft/OSInfo'
$result.results[0].result.actualState.family | Should -BeIn @('Windows', 'Linux', 'macOS')
$LASTEXITCODE | Should -Be 0
}
}
9 changes: 8 additions & 1 deletion dsc_lib/src/configure/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,14 @@ fn add_metadata(kind: &Kind, mut properties: Option<Map<String, Value>> ) -> Res
return Ok(serde_json::to_string(&properties)?);
}

Ok(serde_json::to_string(&properties)?)
match properties {
Some(properties) => {
Ok(serde_json::to_string(&properties)?)
},
_ => {
Ok(String::new())
}
}
}

fn check_security_context(metadata: Option<&Metadata>) -> Result<(), DscError> {
Expand Down