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.
Summary of the new feature / enhancement
As a user, I want
_purge: trueon aPSResourceListinstance so that any resource installed from that repository and not present inresourcesis uninstalled duringset, and reported as a difference duringtest.With
Pester,PSScriptAnalyzerandAz.Accountsinstalled from PSGallery,testreports_inDesiredState: falseandsetuninstallsAz.Accounts.Proposed technical implementation details (optional)
_purgeto thePSResourceListschema, referencing the DSCpurge.jsonproperty schema.GetPSResourceListActions, when_purgeis set, append anUninstallaction for every installed resource from the repository that has no matching desired entry.test,setand what-if pick this up automatically since they share that function.scope: only purge from the scopes the listed resources use, or from both when none is specified, and document which one was chosen.