puppetlabs / puppetlabs-node_manager

Create and manage PE node groups as resources.
Apache License 2.0
10 stars 21 forks source link

Allow string bool input for override_environment #61

Closed reidmv closed 3 years ago

reidmv commented 3 years ago

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.

reidmv commented 3 years ago

@WhatsARanjit if we're looking at a release for #62, can this maybe get pulled in as well?