Skip to content

(dsc): PSResourceList manifest migration for deprecated whatIf to set.whatIfArg #2050

Description

@Gijsreyn

Summary of the new feature / enhancement

psresourcelist.dsc.resource.json implements what-if through the top-level whatIf manifest operation. DSC deprecated that operation in 3.2.0 in favour of set.whatIfArg, where the engine appends an argument to the normal set command instead of running a separate command. Staying on whatIf means a deprecation warning today and a break when the property is removed.

Current manifest:

"whatIf": {
  "executable": "pwsh",
  "args": [ "-NoLogo", "-NonInteractive", "-NoProfile", "-ExecutionPolicy", "Bypass", "-Command",
            "$Input | ./psresourceget.ps1 -resourcetype 'psresourcelist' -operation set -WhatIf; exit $LASTEXITCODE" ],
  "input": "stdin",
  "return": "state"
}

Proposed technical implementation details (optional)

  • Replace the whatIf block with "whatIfArg": "-WhatIf" inside set.
  • whatIfArg is appended after the existing args, which does not work with -Command "...". Switch set to -File ./psresourceget.ps1 -ResourceType psresourcelist -Operation set so the appended -WhatIf binds to the script's [switch]$WhatIf. Verified locally that pwsh -File with stdin input works for this script.
  • Bump $schema on both manifests to a version that includes whatIfArg and set the minimum supported DSC version to 3.2.0 in the README.
  • While in the manifests, the Repository manifest's -Command invocations should also gain ; exit $LASTEXITCODE or move to -File

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions