X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=manifests%2Fparams.pp;h=f4489cdcb5556e45008b62985f493308168126ed;hb=4fa28203b9ca3f12395d0d81df5a690063fc2b47;hp=8edd2e7840583141b944e2e288c415f20b0f8ff4;hpb=001e3a42b971b12305b50859f99d4bce3f422d46;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/manifests/params.pp b/manifests/params.pp index 8edd2e7..f4489cd 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -1,17 +1,34 @@ class apt::params { - if defined('$caller_module_name') and $caller_module_name and $caller_module_name != $module_name { - fail('apt::params is a private class and cannot be accessed directly') - } - if $::osfamily != 'Debian' { fail('This module only works on Debian or derivatives like Ubuntu') } + # Strict variables facts lookup compatibility $xfacts = { 'lsbdistcodename' => defined('$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 +83,23 @@ class apt::params { 'source' => undef, } - $file_defaults = { - 'owner' => 'root', - 'group' => 'root', - 'mode' => '0644', + $include_defaults = { + 'deb' => true, + 'src' => false, } - case $::lsbdistid { + case $xfacts['lsbdistid'] { 'ubuntu', 'debian': { - $distid = $::lsbdistid + $distid = $xfacts['lsbdistid'] $distcodename = $xfacts['lsbdistcodename'] } 'linuxmint': { - if $::lsbdistcodename == 'debian' { + if $xfacts['lsbdistcodename'] == 'debian' { $distid = 'debian' $distcodename = 'wheezy' } else { $distid = 'ubuntu' - $distcodename = $::lsbdistcodename ? { + $distcodename = $xfacts['lsbdistcodename'] ? { 'qiana' => 'trusty', 'petra' => 'saucy', 'olivia' => 'raring', @@ -92,7 +108,7 @@ class apt::params { } } } - '': { + undef: { fail('Unable to determine lsbdistid, is lsb-release installed?') } default: {