Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(PDK-911) Fix handling of ensure values from symbols to strings #55

Merged

Conversation

DavidS
Copy link
Contributor

@DavidS DavidS commented Apr 6, 2018

Tripping over puppet's behaviour for handling newvalue values, rsapi
would accidentally pass symbols for Enum[absent, present] ensures.

The unit and integration tests did not agree on whether absent and
present should be strings or symbols. Puppet itself is calling for
a string as a value for Enums, and in the implementation those two
were only symbols because of a special case in the setup of the two.

This commit fixes this behaviour to always use string. This makes it
consistent with the rest of the API, and reduces the amount of noise
developers have to remember when working with values passed from us.

@DavidS DavidS added the bug label Apr 6, 2018
DavidS added a commit to DavidS/pdk-templates that referenced this pull request Apr 6, 2018
@DavidS DavidS requested a review from tphoney April 6, 2018 14:10
Tripping over puppet's behaviour for handling newvalue values, rsapi
would accidentally pass symbols for `Enum[absent, present]` ensures.

The unit and integration tests did not agree on whether `absent` and
`present` should be strings or symbols. Puppet itself is calling for
a string as a value for `Enum`s, and in the implementation those two
were only symbols because of a special case in the setup of the two.

This commit fixes this behaviour to always use string. This makes it
consistent with the rest of the API, and reduces the amount of noise
developers have to remember when working with values passed from us.
@DavidS DavidS force-pushed the pdk-911-string-symbol-straightening branch from 2384296 to 6639dd0 Compare April 6, 2018 14:19
@@ -210,7 +210,11 @@ def feature_support?(feature)

case options[:type]
when 'Enum[present, absent]'
Puppet::ResourceApi.def_newvalues(self, param_or_property, :absent, :present)
Puppet::ResourceApi.def_newvalues(self, param_or_property, 'absent', 'present')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jeez 😞

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the real bummer is the next line. this here is only cosmetics

@tphoney
Copy link
Contributor

tphoney commented Apr 6, 2018

👍 lets do eet

@DavidS DavidS merged commit 5e0eb43 into puppetlabs:master Apr 6, 2018
@DavidS DavidS deleted the pdk-911-string-symbol-straightening branch April 6, 2018 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants