File tree 3 files changed +26
-8
lines changed
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' {
55
55
$result.metadata .' Microsoft.DSC' .securityContext | Should -Not - BeNullOrEmpty
56
56
$LASTEXITCODE | Should - Be 0
57
57
}
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
+ }
58
77
}
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ Describe 'resource export tests' {
26
26
27
27
$yaml = @'
28
28
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
29
+ contentVersion: 1.2.3
29
30
resources:
30
31
- name: Processes
31
32
type: Microsoft/Process
@@ -39,6 +40,8 @@ Describe 'resource export tests' {
39
40
$config_with_process_list .' resources' | Should -Not - BeNullOrEmpty
40
41
$config_with_process_list.resources.count | Should - BeGreaterThan 1
41
42
$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'
42
45
}
43
46
44
47
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 {
72
72
pub struct Configuration {
73
73
#[ serde( rename = "$schema" ) ]
74
74
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 > ,
76
77
#[ serde( skip_serializing_if = "Option::is_none" ) ]
77
78
pub parameters : Option < HashMap < String , Parameter > > ,
78
79
#[ serde( skip_serializing_if = "Option::is_none" ) ]
@@ -164,13 +165,7 @@ pub enum DocumentSchemaUri {
164
165
165
166
impl Default for Configuration {
166
167
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 ( )
174
169
}
175
170
}
176
171
@@ -179,6 +174,7 @@ impl Configuration {
179
174
pub fn new ( ) -> Self {
180
175
Self {
181
176
schema : DocumentSchemaUri :: Version2024_04 ,
177
+ content_version : Some ( "1.0.0" . to_string ( ) ) ,
182
178
parameters : None ,
183
179
variables : None ,
184
180
resources : Vec :: new ( ) ,
You can’t perform that action at this time.
0 commit comments