Merge pull request #450 from puppetlabs/daenney/guard-lsb-facts

apt::params: Complete $xfacts.
This commit is contained in:
Morgan Haskel 2015-03-03 09:38:29 -08:00
commit acd280bce9

View file

@ -8,10 +8,31 @@ class apt::params {
fail('This module only works on Debian or derivatives like Ubuntu') fail('This module only works on Debian or derivatives like Ubuntu')
} }
# Strict variables facts lookup compatibility
$xfacts = { $xfacts = {
'lsbdistcodename' => defined('$lsbdistcodename') ? { 'lsbdistcodename' => defined('$lsbdistcodename') ? {
true => $::lsbdistcodename, true => $::lsbdistcodename,
default => undef default => undef,
},
'lsbdistrelease' => defined('$lsbdistrelease') ? {
true => $::lsbdistrelease,
default => undef,
},
'lsbmajdistrelease' => defined('$lsbmajdistrelease') ? {
true => $::lsbmajdistrelease,
default => undef,
},
'lsbdistdescription' => defined('$lsbdistdescription') ? {
true => $::lsbdistdescription,
default => undef,
},
'lsbminordistrelease' => defined('$lsbminordistrelease') ? {
true => $::lsbminordistrelease,
default => undef,
},
'lsbdistid' => defined('$lsbdistid') ? {
true => $::lsbdistid,
default => undef,
}, },
} }
@ -66,24 +87,18 @@ class apt::params {
'source' => undef, 'source' => undef,
} }
$file_defaults = { case $xfacts['lsbdistid'] {
'owner' => 'root',
'group' => 'root',
'mode' => '0644',
}
case $::lsbdistid {
'ubuntu', 'debian': { 'ubuntu', 'debian': {
$distid = $::lsbdistid $distid = $xfacts['lsbdistid']
$distcodename = $xfacts['lsbdistcodename'] $distcodename = $xfacts['lsbdistcodename']
} }
'linuxmint': { 'linuxmint': {
if $::lsbdistcodename == 'debian' { if $xfacts['lsbdistcodename'] == 'debian' {
$distid = 'debian' $distid = 'debian'
$distcodename = 'wheezy' $distcodename = 'wheezy'
} else { } else {
$distid = 'ubuntu' $distid = 'ubuntu'
$distcodename = $::lsbdistcodename ? { $distcodename = $xfacts['lsbdistcodename'] ? {
'qiana' => 'trusty', 'qiana' => 'trusty',
'petra' => 'saucy', 'petra' => 'saucy',
'olivia' => 'raring', 'olivia' => 'raring',
@ -92,7 +107,7 @@ class apt::params {
} }
} }
} }
'': { undef: {
fail('Unable to determine lsbdistid, is lsb-release installed?') fail('Unable to determine lsbdistid, is lsb-release installed?')
} }
default: { default: {