-
-
Notifications
You must be signed in to change notification settings - Fork 131
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
Fix strict variables #102
Fix strict variables #102
Conversation
coreone
commented
May 13, 2017
- Fix strict variables for defaults in params.pp
- Fix versioncmp for Puppet 4 in params.pp
- Test for undefined variable in snmp.conf.erb
- Add missing trap_service_name for Debian in params.pp
Fixes Travis errors from #97 |
@gusnuf @razorsedge refactored to comply with CONTRIBUTING. I will re-submit another PR for the master/agentx changes once this PR is merged. |
If support for top-scope variables was no longer needed, something like #85 would make much more sense since it makes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no idea if people are using top-scope variables, so I am leaning towards keeping them for now. If you can help me understand if metadata.json's puppetlabs/stdlib dependency needs to be bumped for getvar
and versioncmp
that would help get this merged.
manifests/params.pp
Outdated
@@ -284,9 +362,11 @@ | |||
|
|||
case $::osfamily { | |||
'RedHat': { | |||
if $::operatingsystemmajrelease { # facter 1.7+ | |||
$osmr = getvar('::operatingsystemmajrelease') | |||
$lsbmdr = getvar('::lsbmajdistrelease') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be necessary as ::operatingsystemmajrelease
and ::lsbmajdistrelease
are facts.
@@ -302,7 +382,7 @@ | |||
$service_config_perms = '0600' | |||
} | |||
default: { | |||
if $majdistrelease <= '5' { | |||
if versioncmp($majdistrelease, '5') <= 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What version of puppetlabs/stdlib (I am assuming this is in puppetlabs/stdlib) has versioncmp
? Do we need to bump dependencies in metadata.json?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
versioncmp is part of Puppet since at least 3.5:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additionally, getvar
is in stdlib 2.3.0, so metadata.json
should not need editing for that either:
https://github.com/puppetlabs/puppetlabs-stdlib/tree/2.3.0/lib/puppet/parser/functions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent.
manifests/params.pp
Outdated
@@ -358,6 +438,7 @@ | |||
$client_package_name = 'snmp' | |||
$client_config = '/etc/snmp/snmp.conf' | |||
|
|||
$trap_service_name = 'snmptrapd' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this have to do with strict vars? I believe it is missing because tested versions of Debian do not have it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In init.pp
, $trap_service_name
is defaulted to $snmp::params::trap_service_name
, so if that is happening on Debian, the default will not exist in params, which can lead to warnings in P4 about undefined variables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case, lets set it to empty ''
.
@razorsedge I believe I answered everything inline... |
@razorsedge should be all set. Set it to empty string instead of |
* Fix versioncmp for Puppet 4 in params.pp * Test for undefined variable in snmp.conf.erb * Add missing trap_service_name for Debian in params.pp
empty string 👎 , undef 👍 |