New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle WhatIf
#70
Comments
Maybe it's just a special arg defined for |
How would WhatIf be different than Test? |
Maybe it's implemented via Test? |
I would see them as distinct. A A |
@mgreenegit we need to think how this would be implemented and what result would be returned. If we require resources to implement it, then it's less likely to be supported. Ideally, we can extract it from the resource metadata in the manifest. A |
I'm not sure how this is different than Test. Is this something that exists in DSC today? |
While |
I think in earlier versions of DSC the WhatIf parameter served a useful purpose, because the only information we got back from the In the new model, where expected_state:
scope: machine
ensure: present
updateAutomatically: false
actual_state:
ensure: absent
scope: machine
diff_properties:
- ensure
- updateAutomatically In this new model, WhatIf support is primarily a different view of the same data, which can be useful for reporting and other integrating tools that have conceptual support for WhatIf (for example, Puppet has a Reusing the output from above, that might look something like (keywords/structure just examples, not proposals): changes:
ensure:
from: present
to: absent |
Agree with @michaeltlombardi I'm a little concerned it will be confused with PowerShell whatif. Maybe we should call it by a different name? |
I think there should be a separate stream with WhatIfMessages and in the absence of a Test implementation and Set implements SupportsShouldProcess, Test would call Set with -WhatIf, capture the WhatIfMessages and if any exist (indicating that something needs to get done) then return false. I also think it would be nice if WhatIfMessages themselves could contain a compliant boolean so that as the set goes through what it would do, you can get positive compliance messages instead of the presence of a WhatIf message indicating non-compliance but not indicating to the user what items are compliant. My experience is that Test and Set generally share a lot of code and look similar. Doing this would prevent the need for code duplication in the Test. |
@dkattan trying to rephrase your comment to avoid PowerShell-specific implementation details:
In v3 the implementation for the Specifically regarding the code duplication problem, I've updated the PowerShell documentation for authoring class-based resources such that the |
Based on most recent discussion, we still need to define schema for |
Alternatives used by other tools include:
Of these options, I think the semantics of It might be worth defining both resources:
- name: Only show what-if
type: Microsoft.Windows/Registry
whatIf: true
properties:
keyPath: HKCU\tailspin\updates
valueName: automatic
valuData: { String: enable }
- name: Show what-if, prompt to enforce
type: Microsoft.Windows/Registry
confirm: true
properties:
keyPath: HKCU\tailspin\updates
valueName: automatic
valuData: { String: enable } I would expect:
|
For now, we can focus on For the implementation, we have a We can also defer resource participation as I think it will depend on #218 which will expose a pattern to pass optional args to exes to indicate |
Summary of the new feature / enhancement
Need to have resources support this to work completely
Proposed technical implementation details (optional)
No response
The text was updated successfully, but these errors were encountered: