Skip to content
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

Add resource support for what if #441

Merged
merged 9 commits into from
Jun 6, 2024

Conversation

tgauth
Copy link
Collaborator

@tgauth tgauth commented May 30, 2024

PR Summary

  • fix Handle WhatIf #70
  • example for resource participation, where whatif is implemented like set but with an additional switch arg:
{
    "$schema": "https://aka.ms/dsc/schemas/resource_manifest",
    // truncated
    "set": {
        "executable": "whatifexample",
        "args": [],
        "return": "state"
    },
    "whatIf": {
        "executable": "whatifexample",
        "args": [
            "--what-if"
        ],
        "return": "state"
    },
    // truncated
}
  • example output from resource that implements whatif, format matches set:
image

PR Context

  • add resource support for config set --what-if

dsc_lib/src/dscresources/dscresource.rs Outdated Show resolved Hide resolved
dsc_lib/src/dscresources/resource_manifest.rs Outdated Show resolved Hide resolved
dsc_lib/src/configure/config_doc.rs Outdated Show resolved Hide resolved
@SteveL-MSFT
Copy link
Member

Should there be a separate schema for what resources return for what-if that aligns with how the engine synthesizes it? Perhaps with addition of reason field that is open text that the resource can fill in

Copy link
Contributor

@anmenaga anmenaga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 questions:

  1. please outline the interface/how resource can participate/enlist/declare 'what-if' support in PR description
  2. are adapter-based resources supported?

@anmenaga
Copy link
Contributor

anmenaga commented Jun 4, 2024

@tgauth please open an issue to add 'whatif' support to PS Adapter.

@SteveL-MSFT
Copy link
Member

Based on the review meeting:

  • Add new whatIf section as a top-level operation in the resource manifest which only applies to set, all other changes in the code will flow from this

@SteveL-MSFT
Copy link
Member

@tgauth can you provide example of what-if output where a resource participates?

@SteveL-MSFT SteveL-MSFT added this pull request to the merge queue Jun 6, 2024
Merged via the queue into PowerShell:main with commit acb01cd Jun 6, 2024
4 checks passed
michaeltlombardi added a commit to michaeltlombardi/DSC that referenced this pull request Jun 13, 2024
This change updates the reference documentation and the
changelog to reflect the support for resource participation
in `dsc config set --what-if` implemented in PowerShell#441.
michaeltlombardi added a commit to michaeltlombardi/DSC that referenced this pull request Jun 13, 2024
This change updates the reference documentation and the
changelog to reflect the support for resource participation
in `dsc config set --what-if` implemented in PowerShell#441.
@tgauth tgauth deleted the add-resource-what-if branch August 27, 2024 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle WhatIf
4 participants