Details
Description
Currently, validation of Puppet types is performed when code generation produces the types - https://github.com/puppetlabs/puppetlabs-dsc/blob/master/build/dsc/templates/dsc_type.rb.erb#L139-L206
However, for other reasons (principally for handling EmbeddedInstance values), each property now carries with it, it's original MOF type per https://github.com/puppetlabs/puppetlabs-dsc/blob/master/build/dsc/templates/dsc_type.rb.erb#L112
Further, helpers were added at https://github.com/puppetlabs/puppetlabs-dsc/blob/master/lib/puppet_x/puppetlabs/dsc_type_helpers.rb for common munging behavior and for validating mof types.
Therefore, we should be able to rewrite the validation procedures to use these helpers instead of always modifying type generation templates. This has the positives of
- Reducing the amount of code generation churn
- Easily changing behavior in one location
- Simplification of the ERB template for generating types, which is starting to get unwieldy
- Reducing the overall amount of code maintained
Steps to produce:
- add unit tests for existing methods in dsc_type_helpers to dsc_type_helpers_spec.rb
- identify validation code that can be moved without extra work to dsc_type_helpers.rb in dsc_type.rb.erb
- investigate how to handle code that cannot be moved from template syntax
Attachments
Issue Links
- blocks
-
MODULES-2761 DSC - Comprehensive Type Validations for all MOF schema types
-
- Accepted
-
- relates to
-
MODULES-2979 DSC - Acceptance and Integration Tests Run Slow
-
- Accepted
-