module-apt/manifests/preferences_snippet.pp
Gabriel Filion 4ebb7d463e Fix apt::preferences::absent
Currently, setting the $custom_preferences variable to false fails
because of the /etc/apt/preferences concatenated_file being re-defined.

Fix this by setting dependencies on the resource only when we expect to
create the /etc/apt/preferences file. Also, since there is no "ensure"
parameter to concatenated_file, use a simple file resource to ensure
that it is removed.

Signed-off-by: Gabriel Filion <lelutin@gmail.com>
2010-10-25 14:15:12 -04:00

33 lines
1,010 B
Puppet

define apt::preferences_snippet(
$ensure = 'present',
$source = '',
$release,
$priority
){
if $custom_preferences == false {
fail("Trying to define a preferences_snippet with \$custom_preferences set to false.")
}
include apt::preferences
file { "${apt::preferences::apt_preferences_dir}/${name}":
ensure => $ensure,
#TODO this template is somewhat limited
notify => Exec["concat_${apt::preferences::apt_preferences_dir}"],
owner => root, group => 0, mode => 0600;
}
# This should really work in the same manner as sources_list and apt_conf
# snippets, but since the preferences.d directory cannot be used in Debian
# lenny, we can't generalize without going into ugly special-casing.
case $source {
'' =>
File["${apt::preferences::apt_preferences_dir/${name}"] {
content => template("apt/preferences_snippet.erb")
},
default =>
File["${apt::preferences::apt_preferences_dir/${name}"] {
source => $source
}
}
}