module-apt/manifests/apt_conf_snippet.pp
Gabriel Filion d97a49b7b2 refactor: simplify and remove inline content
Simplifications: make apt_conf_snippet repeat less code, make code that
generates sources.list more concise.

Remove all inline content in favor of templates and static files.
The ability to include sources for static files was needed for
the main 'preferences' file, so it was added to the preferences_snippet
define.

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

29 lines
694 B
Puppet

define apt::apt_conf_snippet(
$ensure = 'present',
$source = '',
$content = undef
){
if $source == '' and $content == undef {
fail("One of \$source or \$content must be specified for apt_conf_snippet ${name}")
}
if $source != '' and $content != undef {
fail("Only one of \$source or \$content must specified for apt_conf_snippet ${name}")
}
file { "/etc/apt/apt.conf.d/${name}":
ensure => $ensure,
notify => Exec["refresh_apt"],
owner => root, group => 0, mode => 0600;
}
if $source {
File["/etc/apt/apt.conf.d/${name}"] {
source => $source,
}
}
else {
File["/etc/apt/apt.conf.d/${name}"] {
content => $content,
}
}
}