@@ -18,7 +18,7 @@ function Write-DscTrace {
18
18
[string ]$Message
19
19
)
20
20
21
- $trace = @ {$Operation = $Message } | ConvertTo-Json - Compress
21
+ $trace = @ {$Operation.ToLower () = $Message } | ConvertTo-Json - Compress
22
22
$host.ui.WriteErrorLine ($trace )
23
23
}
24
24
@@ -47,7 +47,7 @@ if ($Operation -eq 'ClearCache') {
47
47
48
48
if (' Validate' -ne $Operation ) {
49
49
# write $jsonInput to STDERR for debugging
50
- $trace = @ {' Debug ' = ' jsonInput=' + $jsonInput } | ConvertTo-Json - Compress
50
+ $trace = @ {' debug ' = ' jsonInput=' + $jsonInput } | ConvertTo-Json - Compress
51
51
$host.ui.WriteErrorLine ($trace )
52
52
53
53
# load private functions of psDscAdapter stub module
@@ -92,7 +92,7 @@ switch ($Operation) {
92
92
$capabilities = $module.PrivateData.PSData.DscCapabilities
93
93
}
94
94
else {
95
- $capabilities = @ (' Get ' , ' Set ' , ' Test ' )
95
+ $capabilities = @ (' get ' , ' set ' , ' test ' )
96
96
}
97
97
}
98
98
@@ -119,7 +119,7 @@ switch ($Operation) {
119
119
# OUTPUT dsc is expecting the following properties
120
120
[resourceOutput ]@ {
121
121
type = $dscResource.Type
122
- kind = ' Resource '
122
+ kind = ' resource '
123
123
version = [string ]$DscResourceInfo.version
124
124
capabilities = $capabilities
125
125
path = $DscResourceInfo.Path
@@ -135,22 +135,22 @@ switch ($Operation) {
135
135
{ @ (' Get' , ' Set' , ' Test' , ' Export' ) -contains $_ } {
136
136
$desiredState = $psDscAdapter.invoke ( { param ($jsonInput ) Get-DscResourceObject - jsonInput $jsonInput }, $jsonInput )
137
137
if ($null -eq $desiredState ) {
138
- $trace = @ {' Debug ' = ' ERROR: Failed to create configuration object from provided input JSON.' } | ConvertTo-Json - Compress
138
+ $trace = @ {' debug ' = ' ERROR: Failed to create configuration object from provided input JSON.' } | ConvertTo-Json - Compress
139
139
$host.ui.WriteErrorLine ($trace )
140
140
exit 1
141
141
}
142
142
143
143
# only need to cache the resources that are used
144
144
$dscResourceModules = $desiredState | ForEach-Object { $_.Type.Split (' /' )[0 ] }
145
145
if ($null -eq $dscResourceModules ) {
146
- $trace = @ {' Debug ' = ' ERROR: Could not get list of DSC resource types from provided JSON.' } | ConvertTo-Json - Compress
146
+ $trace = @ {' debug ' = ' ERROR: Could not get list of DSC resource types from provided JSON.' } | ConvertTo-Json - Compress
147
147
$host.ui.WriteErrorLine ($trace )
148
148
exit 1
149
149
}
150
150
151
151
$dscResourceCache = Invoke-DscCacheRefresh - module $dscResourceModules
152
152
if ($dscResourceCache.count -lt $dscResourceModules.count ) {
153
- $trace = @ {' Debug ' = ' ERROR: DSC resource module not found.' } | ConvertTo-Json - Compress
153
+ $trace = @ {' debug ' = ' ERROR: DSC resource module not found.' } | ConvertTo-Json - Compress
154
154
$host.ui.WriteErrorLine ($trace )
155
155
exit 1
156
156
}
@@ -159,7 +159,7 @@ switch ($Operation) {
159
159
# process the INPUT (desiredState) for each resource as dscresourceInfo and return the OUTPUT as actualState
160
160
$actualState = $psDscAdapter.invoke ( { param ($op , $ds , $dscResourceCache ) Invoke-DscOperation - Operation $op - DesiredState $ds - dscResourceCache $dscResourceCache }, $Operation , $ds , $dscResourceCache )
161
161
if ($null -eq $actualState ) {
162
- $trace = @ {' Debug ' = ' ERROR: Incomplete GET for resource ' + $ds.Name } | ConvertTo-Json - Compress
162
+ $trace = @ {' debug ' = ' ERROR: Incomplete GET for resource ' + $ds.Name } | ConvertTo-Json - Compress
163
163
$host.ui.WriteErrorLine ($trace )
164
164
exit 1
165
165
}
@@ -168,7 +168,7 @@ switch ($Operation) {
168
168
169
169
# OUTPUT json to stderr for debug, and to stdout
170
170
$result = @ { result = $result } | ConvertTo-Json - Depth 10 - Compress
171
- $trace = @ {' Debug ' = ' jsonOutput=' + $result } | ConvertTo-Json - Compress
171
+ $trace = @ {' debug ' = ' jsonOutput=' + $result } | ConvertTo-Json - Compress
172
172
$host.ui.WriteErrorLine ($trace )
173
173
return $result
174
174
}
0 commit comments