-
Notifications
You must be signed in to change notification settings - Fork 52
Open
Labels
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.
DSC/powershell-adapter/psDscAdapter/powershell.resource.ps1
Lines 90 to 100 in 7ed105e
| # Provide a way for existing resources to specify their capabilities, or default to Get, Set, Test | |
| # TODO: for perf, it is better to take capabilities from psd1 in Invoke-DscCacheRefresh, not by extra call to Get-Module | |
| if ($DscResourceInfo.ModuleName) { | |
| $module = Get-Module -Name $DscResourceInfo.ModuleName -ListAvailable | Sort-Object -Property Version -Descending | Select-Object -First 1 | |
| if ($module.PrivateData.PSData.DscCapabilities) { | |
| $capabilities = $module.PrivateData.PSData.DscCapabilities | |
| } | |
| else { | |
| $capabilities = @('get', 'set', 'test') | |
| } | |
| } |
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/aActual behavior
n/aError details
Environment data
n/aVersion
3.1-preview6
Visuals
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Reviewed