Prerequisites
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.
|
# 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
Actual behavior
Error details
Environment data
Version
3.1-preview6
Visuals
No response
Prerequisites
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
The schema should be updated to allow individual resources to specify their capabilities.
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