You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the course of early user feedback for the Puppetized DSC modules, we have discovered that numerous DSC Resources are not able to have their state properly validated using the default property insync logic in Puppet. The sorts of problems encountered are as complicated as the issues in ActiveDirectoryDsc and NetworkingDsc or as straightforward as a Resource not returning a key property in Get (see these two PRs: 1, 2).
When property-by-property state comparisons are not possible, one of several problems from this non-exhaustive list can show up:
Flapping resources, applying on every run
Resources applying state when they shouldn't
Resources not applying state when they should
Resources erroring on type mismatches of desired state and actual
Describe the Solution You Would Like
When puppetlabs/puppet-resource_api#285 is merged and available in Puppet 6&7 it will be possible to implement a custom insync? method on the DSC base provider. This would enable the use of DSC's own state comparison checking to be leveraged in place of Puppet's. However, it would do so at the cost of property-by-property reporting; DSC's Test method invocation returns only true or false and does not indicate which properties, if any, are out of desired state.
Enabling this override should be on a resource-by-resource case in the manifest, with the default behavior being the existing property-by-property reporting. If an override is specified to instead use the less granular test method for comparing desired state.
Additional Context
The following issues would all benefit from using a resource validation mode instead of property-by-property:
Use Case
In the course of early user feedback for the Puppetized DSC modules, we have discovered that numerous DSC Resources are not able to have their state properly validated using the default property insync logic in Puppet. The sorts of problems encountered are as complicated as the issues in ActiveDirectoryDsc and NetworkingDsc or as straightforward as a Resource not returning a key property in
Get
(see these two PRs: 1, 2).When property-by-property state comparisons are not possible, one of several problems from this non-exhaustive list can show up:
Describe the Solution You Would Like
When puppetlabs/puppet-resource_api#285 is merged and available in Puppet 6&7 it will be possible to implement a custom
insync?
method on the DSC base provider. This would enable the use of DSC's own state comparison checking to be leveraged in place of Puppet's. However, it would do so at the cost of property-by-property reporting; DSC'sTest
method invocation returns onlytrue
orfalse
and does not indicate which properties, if any, are out of desired state.Enabling this override should be on a resource-by-resource case in the manifest, with the default behavior being the existing property-by-property reporting. If an override is specified to instead use the less granular test method for comparing desired state.
Additional Context
The following issues would all benefit from using a resource validation mode instead of property-by-property:
Acceptance Criteria
custom_insync
feature to generated typesvalidation_mode
attribute to generated types which takes the enumsproperty
andresource
, defaulting toproperty
validation_mode
and especially guidance on when to use itvalidation_mode
set toproperty
but succeeds withvalidation_mode
set toresource
cached_query_results
invoke_test_method
which passes ashould
hash toInvoke-DscResource
and caches the result tocached_query_results
insync?
method which takescontext
,name
,attribute_name
,is_hash
, andshould_hash
parameters:validation_mode
is set toresource
:invoke_test_method
unless the resource insync state is already cached incached_test_results
true
if in desired state andfalse
if notvalidation_mode
is set toproperty
:invoke_test_method
insync?
The text was updated successfully, but these errors were encountered: