PowerShell / PowerShell/DSC

Class-based resource capabilities in module manifest

Open
#852 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue-Enhancement Need-Review
Dominant language
Rust
Stars
523
Forks
75
Avg merge
3d 16h
Merged PRs (30d)
24

Description

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

There is an option in the module manifest to set which capabilities are present for a resource however that applies to all resources in the module and not to individual resources.

https://github.com/PowerShell/DSC/blob/7ed105eef99ab73b05da14759f4f2cab01e2546d/powershell-adapter/psDscAdapter/powershell.resource.ps1#L90-L100

The schema should be updated to allow individual resources to specify their capabilities.

PSData = @{
  DscCapabilities = @{
    TestClassResource = @('get', test', 'export)
    NoExport = @('get', test')
  }
}

The ideal state is to allow class-based resources to not have to implement all methods. This could be done by checking the AST if the method contains a throw [NotImplementedException]::new() so that the code and capabilities match at all times.

Steps to reproduce

n/a

Expected behavior
n/a
Actual behavior
n/a
Error details

Environment data
n/a
Version

3.1-preview6

Visuals

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with powershell-adapter/psDscAdapter/powershell.resource.ps1 around lines 90-100 and inspect how module-wide DscCapabilities are read. Review the manifest schema and determine how individual class-based resources should declare capabilities, including whether the proposed AST check for NotImplementedException is in scope. Done means the schema and adapter consistently support per-resource capabilities.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
devops
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.