module-puppetlabs-apt/manifests/pin.pp

49 lines
1.1 KiB
ObjectPascal
Raw Normal View History

2010-04-27 22:38:28 +02:00
# pin.pp
# pin a release in apt, useful for unstable repositories
define apt::pin(
$ensure = present,
$explanation = "${::caller_module_name}: ${name}",
$order = '',
$packages = '*',
$priority = 0,
$release = '',
$origin = '',
$originator = '',
$version = ''
2010-04-27 22:38:28 +02:00
) {
include apt::params
2010-04-27 22:38:28 +02:00
$preferences_d = $apt::params::preferences_d
if $order != '' and !is_integer($order) {
fail('Only integers are allowed in the apt::pin order param')
}
if $release != '' {
$pin = "release a=${release}"
} elsif $origin != '' {
$pin = "origin \"${origin}\""
} elsif $originator != '' {
$pin = "release o=${originator}"
} elsif $version != '' {
$pin = "version ${version}"
} else {
2012-05-22 00:03:30 +02:00
$pin = "release a=${name}"
}
$path = $order ? {
'' => "${preferences_d}/${name}.pref",
default => "${preferences_d}/${order}-${name}.pref",
}
file { "${name}.pref":
ensure => $ensure,
path => $path,
owner => root,
group => root,
mode => '0644',
2012-08-21 22:55:24 +02:00
content => template('apt/pin.pref.erb'),
}
2010-04-27 22:38:28 +02:00
}