X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=manifests%2Fpin.pp;h=8e2873a9c042070dce835c30aa69aee094326ef2;hb=95beb15266d52e8f91a60b4cbe6d5086959b6b22;hp=b69e230ea077f1c31e16fa5791349ed196daf6f0;hpb=a840dd8372d8a89dd0dab0f8b41ade29a77761da;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/manifests/pin.pp b/manifests/pin.pp index b69e230..8e2873a 100644 --- a/manifests/pin.pp +++ b/manifests/pin.pp @@ -2,21 +2,34 @@ # pin a release in apt, useful for unstable repositories define apt::pin( - $ensure = present, - $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": ensure => $ensure, - path => "${preferences_d}/${name}", + path => "${preferences_d}/${name}.pref", owner => root, group => root, mode => '0644', - content => "# ${name}\nPackage: ${packages}\nPin: release a=${name}\nPin-Priority: ${priority}", + content => template("apt/pin.pref.erb"), } }