X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=manifests%2Fpin.pp;h=8e2873a9c042070dce835c30aa69aee094326ef2;hb=95beb15266d52e8f91a60b4cbe6d5086959b6b22;hp=40695af5fa8f84eb4cba4a2ca26ebd84b57818d4;hpb=0fb5f78379ef167d30770d14d6fee2b6787eeadd;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/manifests/pin.pp b/manifests/pin.pp index 40695af..8e2873a 100644 --- a/manifests/pin.pp +++ b/manifests/pin.pp @@ -2,18 +2,34 @@ # pin a release in apt, useful for unstable repositories define apt::pin( - $packages = '*', - $priority = 0 + $ensure = present, + $packages = '*', + $priority = 0, + $release = '', + $origin = '', + $originator = '', ) { include apt::params + $preferences_d = $apt::params::preferences_d + + if $release != '' { + $pin = "release a=${release}" + } elsif $origin != '' { + $pin = "origin \"${origin}\"" + } elsif $originator != '' { + $pin = "release o=${originator}" + } else { + $pin = "release a=${name}" + } + file { "${name}.pref": - path => "${apt::params::root}/preferences.d/${name}", - ensure => file, - owner => root, - group => root, - mode => 644, - content => "# ${name}\nPackage: ${packages}\nPin: release a=${name}\nPin-Priority: ${priority}", + ensure => $ensure, + path => "${preferences_d}/${name}.pref", + owner => root, + group => root, + mode => '0644', + content => template("apt/pin.pref.erb"), } }