X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=manifests%2Fbackports.pp;h=f7e85f59ed9744fdaaaa8ce7b46d9b788e23ce60;hb=7aa9778e4d418943592f80a76e9978ebc3d084e3;hp=f4c5faaf8997e1ce3db5be5b518314f72f6b9f84;hpb=8f5cb7341ae362442dfd8e06129d39583f588bf0;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/manifests/backports.pp b/manifests/backports.pp index f4c5faa..f7e85f5 100644 --- a/manifests/backports.pp +++ b/manifests/backports.pp @@ -4,7 +4,7 @@ class apt::backports ( $repos = undef, $key = undef, $pin = 200, -) inherits apt::params { +){ if $location { validate_string($location) $_location = $location @@ -23,24 +23,18 @@ class apt::backports ( } $_key = $key } - unless is_hash($pin) { - unless (is_numeric($pin) or is_string($pin)) { - fail('pin must be either a string, number or hash') - } - } - - if ($::apt::params::xfacts['lsbdistid'] == 'debian' or $::apt::params::xfacts['lsbdistid'] == 'ubuntu') { + if ($::apt::xfacts['lsbdistid'] == 'debian' or $::apt::xfacts['lsbdistid'] == 'ubuntu') { unless $location { - $_location = $::apt::params::backports['location'] + $_location = $::apt::backports['location'] } unless $release { - $_release = "${::apt::params::xfacts['lsbdistcodename']}-backports" + $_release = "${::apt::xfacts['lsbdistcodename']}-backports" } unless $repos { - $_repos = $::apt::params::backports['repos'] + $_repos = $::apt::backports['repos'] } unless $key { - $_key = $::apt::params::backports['key'] + $_key = $::apt::backports['key'] } } else { unless $location and $release and $repos and $key { @@ -48,12 +42,24 @@ class apt::backports ( } } + if is_hash($pin) { + $_pin = $pin + } elsif is_numeric($pin) or is_string($pin) { + # apt::source defaults to pinning to origin, but we should pin to release + # for backports + $_pin = { + 'priority' => $pin, + 'release' => $_release, + } + } else { + fail('pin must be either a string, number or hash') + } + apt::source { 'backports': location => $_location, release => $_release, repos => $_repos, key => $_key, - pin => $pin, + pin => $_pin, } - }