Skip to content

Commit

Permalink
Fix params.pp version comparison for Puppet 4
Browse files Browse the repository at this point in the history
If the `$::smartmontools_version` fact does not exisist (is `undef`)
then `versioncmp()` will fail with a type error.  This adds a check to
define it as `0.0` in such a case.
  • Loading branch information
lamawithonel committed Nov 23, 2015
1 parent c6f5f18 commit 5530876
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,13 @@
$warning_schedule = 'daily' # other choices: once, diminishing
$default_options = undef

$version_string = $::smartmontools_version ? {
undef => '0.0',
default => $::smartmontools_version,
}

# smartd.conf < 5.43 does not support the 'DEFAULT' directive
if versioncmp($::smartmontools_version, '5.43') >= 0 {
if versioncmp($version_string, '5.43') >= 0 {
$enable_default = true
} else {
$enable_default = false
Expand Down

0 comments on commit 5530876

Please sign in to comment.