(dsc): Add `_purge` to `PSResourceList` resource

Open
#2,052 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
64/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
csharp, powershell
Domain
cli

Research direction

Start with the PSResourceList schema, the DSC purge.json property schema, and GetPSResourceListActions. Trace how test, set, and what-if consume those actions, then verify that unmatched installed resources are reported or uninstalled according to _purge and the selected scope.

Written by the indexing model from the issue text.

Description

feature_request Needs-Triage
Summary of the new feature / enhancement

As a user, I want _purge: true on a PSResourceList instance so that any resource installed from that repository and not present in resources is uninstalled during set, and reported as a difference during test.

resources:
- name: Only these modules
  type: Microsoft.PowerShell.PSResourceGet/PSResourceList
  properties:
    repositoryName: PSGallery
    _purge: true
    resources:
    - name: Pester
    - name: PSScriptAnalyzer

With Pester, PSScriptAnalyzer and Az.Accounts installed from PSGallery, test reports _inDesiredState: false and set uninstalls Az.Accounts.

Proposed technical implementation details (optional)
  • Add _purge to the PSResourceList schema, referencing the DSC purge.json property schema.
  • In GetPSResourceListActions, when _purge is set, append an Uninstall action for every installed resource from the repository that has no matching desired entry. test, set and what-if pick this up automatically since they share that function.
  • Respect scope: only purge from the scopes the listed resources use, or from both when none is specified, and document which one was chosen.
Dominant language
C#
Stars
576
Forks
114
Avg merge
1d 2h
Merged PRs (30d)
7

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.

More from PowerShell/PSResourceGet

All issues in PowerShell/PSResourceGet

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.