This is mostly to make it so that the output of puppet resource node_group, for the override_environment parameter, is valid input.
The output of puppet resource shows a string type value for the environment_override parameter. However, a string is not a valid input for the classifier's REST API. The API only accepts boolean data types. If a string like "true" is passed through all the way to the API, an error will occur and the type won't work.
This commit adds a munge method to the boolean type to internally convert use input of strings, actual booleans, etc. to Boolean type values. This ensures that valid data is passed to the classifier API, and also happens to validate user input.
Some cleanup was required in the https provider's create method to make this work. Previously the provider used @resource.original_parameters instead of @resource.properties, so cleaup (munging) wasn't being benefited from.
The spec test had to be changed to submit valid input (a string "false" to environment_trumps was never valid input to begin with, so this is a positive test change), and also to adjust order of keys submitted. Apparently webmock is very sensitive to that.
This is mostly to make it so that the output of
puppet resource node_group
, for theoverride_environment
parameter, is valid input.The output of
puppet resource
shows a string type value for the environment_override parameter. However, a string is not a valid input for the classifier's REST API. The API only accepts boolean data types. If a string like "true" is passed through all the way to the API, an error will occur and the type won't work.This commit adds a munge method to the boolean type to internally convert use input of strings, actual booleans, etc. to Boolean type values. This ensures that valid data is passed to the classifier API, and also happens to validate user input.
Some cleanup was required in the https provider's create method to make this work. Previously the provider used @resource.original_parameters instead of @resource.properties, so cleaup (munging) wasn't being benefited from.
The spec test had to be changed to submit valid input (a string "false" to environment_trumps was never valid input to begin with, so this is a positive test change), and also to adjust order of keys submitted. Apparently webmock is very sensitive to that.