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

Quoted booleans in Puppet5 for Enum type declarations. #720

Closed
Aethylred opened this issue Jul 7, 2017 · 3 comments
Closed

Quoted booleans in Puppet5 for Enum type declarations. #720

Aethylred opened this issue Jul 7, 2017 · 3 comments
Milestone

Comments

@Aethylred
Copy link

Aethylred commented Jul 7, 2017

The Puppet 5.x documentation requires that Boolean types are quoted when used in Enum declarations [here|https://docs.puppet.com/puppet/5.0/lang_data_type.html#syntax]

To be clear, the following statement will not compile without the quotes around the boolean values:

Variant[Boolean, Enum['true', 'false', 'running', 'stopped']]

puppet-lint should allow quoted Booleans in this specific context.

Note: disabling this for a specific line works when testing puppet code, however the Puppet Forge explicitly ignores disabled checks in a module leading to an 0.0 score for a required breach of style for correct syntax.

@Aethylred
Copy link
Author

This may be an anti-pattern in the Puppet 5.0 documentation, as this provides the same functionality, but rejects quoted Booleans:

Variant[Boolean, Enum['running', 'stopped']]

@rnelson0
Copy link
Collaborator

rnelson0 commented Jul 8, 2017

It's not an anti-pattern per se, but it's not required either. The example from the docs accepts booleans OR strings true and false. While I am a fan of using booleans vs strings personally, I don't know that I would foist that opinion on others.

However, the style guide is more important there. I'm not in a position to check it now, but that's the reference we need to check.

@rodjek rodjek added the bug label Aug 6, 2017
@rodjek rodjek added this to the Next release (2.3.0 maybe?) milestone Aug 6, 2017
@rodjek
Copy link
Owner

rodjek commented Aug 21, 2017

I think this is an anti-pattern in the documentation that should be fixed there. Allowing quoted booleans in the Enum in puppet-lint would just shift the problem to another manifest, as wherever the defined type or class that used this data type was instantiated would then throw a quoted boolean error.

class test {
  Variant[Boolean, Enum['true', 'false', 'absent', 'present']] $ensure,
}

class { 'test':
  ensure => 'true', # <== We've just shifted the puppet-lint warning to here.
}

@Aethylred Thoughts/counter arguments? :)

@rodjek rodjek removed the bug label Aug 21, 2017
@rodjek rodjek closed this as completed Aug 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants