File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -347,6 +347,8 @@ class PSClassResource {
347
347
$out = dsc resource get - r PSClassResource/ PSClassResource -- input (@ {Name = ' TestName' } | ConvertTo-Json ) | ConvertFrom-Json
348
348
$LASTEXITCODE | Should - Be 0
349
349
$out.actualState.Name | Should - Be ' TestName'
350
+ $propCount = $out.actualState | Get-Member - MemberType NoteProperty
351
+ $propCount.Count | Should - Be 1 # Only the DscProperty should be returned
350
352
}
351
353
352
354
It ' Set works with class-based PS DSC resources' - Skip:(! $IsWindows ) {
Original file line number Diff line number Diff line change @@ -402,6 +402,10 @@ function Invoke-DscOperation {
402
402
$resource = GetTypeInstanceFromModule - modulename $cachedDscResourceInfo.ModuleName - classname $cachedDscResourceInfo.Name
403
403
$dscResourceInstance = $resource ::New()
404
404
405
+ $ValidProperties = $cachedDscResourceInfo.Properties.Name
406
+
407
+ $ValidProperties | ConvertTo-Json | Write-DscTrace - Operation Trace
408
+
405
409
if ($DesiredState.properties ) {
406
410
# set each property of $dscResourceInstance to the value of the property in the $desiredState INPUT object
407
411
$DesiredState.properties.psobject.properties | ForEach-Object - Process {
@@ -427,7 +431,17 @@ function Invoke-DscOperation {
427
431
428
432
switch ($Operation ) {
429
433
' Get' {
430
- $Result = $dscResourceInstance.Get ()
434
+ $Result = @ {}
435
+ $raw_obj = $dscResourceInstance.Get ()
436
+ $ValidProperties | ForEach-Object {
437
+ if ($raw_obj .$_ -is [System.Enum ]) {
438
+ $Result [$_ ] = $raw_obj .$_.ToString ()
439
+
440
+ }
441
+ else {
442
+ $Result [$_ ] = $raw_obj .$_
443
+ }
444
+ }
431
445
$addToActualState.properties = $Result
432
446
}
433
447
' Set' {
You can’t perform that action at this time.
0 commit comments