File tree Expand file tree Collapse file tree 3 files changed +26
-8
lines changed Expand file tree Collapse file tree 3 files changed +26
-8
lines changed Original file line number Diff line number Diff line change @@ -55,4 +55,23 @@ Describe 'dsc config get tests' {
5555 $result.metadata .' Microsoft.DSC' .securityContext | Should -Not - BeNullOrEmpty
5656 $LASTEXITCODE | Should - Be 0
5757 }
58+
59+ It ' contentVersion is ignored' {
60+ $config_yaml = @"
61+ `$ schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
62+ contentVersion: 1.0.0.0
63+ resources:
64+ - name: Echo
65+ type: Microsoft.DSC.Debug/Echo
66+ properties:
67+ output: hello
68+ "@
69+ $result = $config_yaml | dsc config get -f - | ConvertFrom-Json
70+ $result.hadErrors | Should - BeFalse
71+ $result.results.Count | Should - Be 1
72+ $result.results [0 ].Name | Should - Be ' Echo'
73+ $result.results [0 ].type | Should - BeExactly ' Microsoft.DSC.Debug/Echo'
74+ $result.results [0 ].result.actualState.output | Should - Be ' hello'
75+ $LASTEXITCODE | Should - Be 0
76+ }
5877}
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ Describe 'resource export tests' {
2626
2727 $yaml = @'
2828 $schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
29+ contentVersion: 1.2.3
2930 resources:
3031 - name: Processes
3132 type: Microsoft/Process
@@ -39,6 +40,8 @@ Describe 'resource export tests' {
3940 $config_with_process_list .' resources' | Should -Not - BeNullOrEmpty
4041 $config_with_process_list.resources.count | Should - BeGreaterThan 1
4142 $config_with_process_list.metadata .' Microsoft.DSC' .operation | Should - BeExactly ' Export'
43+ # contentVersion on export is always 1.0.0
44+ $config_with_process_list.contentVersion | Should - BeExactly ' 1.0.0'
4245 }
4346
4447 It ' Configuration Export can be piped to configuration Set' - Skip:(! $IsWindows ) {
Original file line number Diff line number Diff line change @@ -72,7 +72,8 @@ pub struct Metadata {
7272pub struct Configuration {
7373 #[ serde( rename = "$schema" ) ]
7474 pub schema : DocumentSchemaUri ,
75- // `contentVersion` is required by ARM, but doesn't serve a purpose here
75+ #[ serde( rename = "contentVersion" ) ]
76+ pub content_version : Option < String > ,
7677 #[ serde( skip_serializing_if = "Option::is_none" ) ]
7778 pub parameters : Option < HashMap < String , Parameter > > ,
7879 #[ serde( skip_serializing_if = "Option::is_none" ) ]
@@ -164,13 +165,7 @@ pub enum DocumentSchemaUri {
164165
165166impl Default for Configuration {
166167 fn default ( ) -> Self {
167- Self {
168- schema : DocumentSchemaUri :: Version2024_04 ,
169- parameters : None ,
170- variables : None ,
171- resources : Vec :: new ( ) ,
172- metadata : None ,
173- }
168+ Self :: new ( )
174169 }
175170}
176171
@@ -179,6 +174,7 @@ impl Configuration {
179174 pub fn new ( ) -> Self {
180175 Self {
181176 schema : DocumentSchemaUri :: Version2024_04 ,
177+ content_version : Some ( "1.0.0" . to_string ( ) ) ,
182178 parameters : None ,
183179 variables : None ,
184180 resources : Vec :: new ( ) ,
You can’t perform that action at this time.
0 commit comments