Skip to content

DSC doesn't populate the whatIf capability for resources #1501

@michaeltlombardi

Description

@michaeltlombardi

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest version
  • Search the existing issues.

Summary

When reviewing the output for dsc resource list, I noticed that the Microsoft.Windows/Registry resource isn't reported as having the whatIf capability even though both the set and delete operations explicitly support what-if mode in the manifest.

This seems to be because the load_resource_manifest function doesn't check the manifest for what-if functionality unlike the other capabilities. To fix this bug, we would need to update the function to correctly detect what-if support for the resource.

Steps to reproduce

  1. Invoke the following command on a Windows machine:

    dsc resource list Microsoft.Windows/Registry --output-format yaml
  2. Review the output to see that the capabilities field doesn't include whatIf.

Expected behavior

dsc resource list Microsoft.Windows/Registry --output-format yaml |
    ConvertFrom-Json |
    Select-Object -ExpandProperty capabilities

get
set
whatIf
delete

Actual behavior

dsc resource list Microsoft.Windows/Registry --output-format yaml |
    ConvertFrom-Json |
    Select-Object -ExpandProperty capabilities

get
set
delete

Error details

Environment data

Name                           Value
----                           -----
PSVersion                      7.6.1
PSEdition                      Core
GitCommitId                    7.6.1
OS                             Microsoft Windows 10.0.26200
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.4
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Version

latest main ( commit 9288f0c2200d95e8c9e58153f374d8b8182a33b3)

Visuals

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions