-
-
Notifications
You must be signed in to change notification settings - Fork 75
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
Module doesn't work with Puppet 4 due to undef variable passing #82
Comments
Question for the team: should a new TravisCI scenario be added for Puppet 4.0 with STRICT_VARIABLES=YES? |
Hi there, I have put in a PR which seems to work for me with basic testing on PE 2016.4.0 with strict variables enabled |
@tux-o-matic while not on the team, I would suggest that it is definitly a good idea, knowing several people within Puppet and listening to their recommendations as well as the offical Puppet documentation that states this will be enforced in Puppet 5 as well as being something that is very sensible to enable it would, to me at least make sense ensuring this variable is set so that the code quality is not only kept to the upstream standard but also so there is less rework in the future. |
Fixes voxpupuli#82 Using `getvar()` as it has better compatibility than `defined()` See https://tickets.puppetlabs.com/browse/PUP-4072 for example.
Affected Puppet, Ruby, OS and module versions/distributions
How to reproduce (e.g Puppet code you use)
Try using the module under any version of Puppet 4.x (assuming you do have strict_variables enabled which you should as it will be enforced shortly).
What are you seeing
Compilation fails when accessing variables from facts that don't yet exist as the module hasn't created them.
It looks like it's using the old Puppet 2/3 style
if param == undef
, when it should be usingif defined(param)
.See: https://docs.puppet.com/puppet/latest/reference/lang_facts_and_builtin_vars.html#compiler-variables
Available and should be used as of Puppet 4.x:
strict_variables = true (Puppet master/apply only) — This makes uninitialized variables cause parse errors, which can help squash difficult bugs by failing early instead of carrying undef values into places that don’t expect them.
What behaviour did you expect instead
Facts to be loaded, then usable.
Output log
Although the peers are set in hiera and are being called from the profile.
cc/ @ross-w
The text was updated successfully, but these errors were encountered: