Add support for reporting how a DSC Resource is out-of-state via the Test method #77
michaeltlombardi
started this conversation in
Ideas
Replies: 2 comments 2 replies
-
The use case makes sense. I think a new switch for invoking |
Beta Was this translation helpful? Give feedback.
1 reply
-
Isn't this already covered if the resource implements the |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
With the current implementation of DSC, I can verify that a particular DSC Resource is in or out of desired state with the Test method. I can manually compare the current state (retrieved with the Get method) to my desired state; however, this manual comparison will often require me to reimplement the functionality of the DSC Resource's own test code for complex resources; only DSC Resources whose values can be compared directly are relatively easy to inspect. Even then, it's additional work on the part of integrating vendors and users.
I propose extending the interface definition of a DSC Resource by enabling them to return a report on out-of-state properties when
Invoke-DscResource -Method Test
would return a$false
result (i.e. the resource is out of desired state) for the purposes of both investigation and integration.Proposed Solution
The implementation for this could break the existing usage of the
Test
method forInvoke-DscResource
, so should perhaps be placed behind a switch likeDetailed
.In the class, this could be implemented with a new
TestDetailed()
method which returns a hashtable like:Probably, this hashtable should itself be a defined and exported class, maybe
DscTestResult
.Another option to maintain (some) backwards compatibility would be to update the logic of
Invoke-DscResource
when callingTest
: if the result of the call is a simple boolean, report the information in the existing result info.Beta Was this translation helpful? Give feedback.
All reactions