2010-10-25 07:44:04 +02:00
|
|
|
define apt::apt_conf(
|
2010-10-24 15:07:34 +02:00
|
|
|
$ensure = 'present',
|
|
|
|
$source = '',
|
2013-02-01 11:01:23 +01:00
|
|
|
$content = undef,
|
|
|
|
$refresh_apt = true )
|
2010-12-07 19:18:41 +01:00
|
|
|
{
|
|
|
|
|
2010-10-24 15:07:34 +02:00
|
|
|
if $source == '' and $content == undef {
|
2010-10-25 07:44:04 +02:00
|
|
|
fail("One of \$source or \$content must be specified for apt_conf ${name}")
|
2010-10-24 15:07:34 +02:00
|
|
|
}
|
2010-12-07 19:18:41 +01:00
|
|
|
|
2010-10-24 15:07:34 +02:00
|
|
|
if $source != '' and $content != undef {
|
2010-10-25 07:44:04 +02:00
|
|
|
fail("Only one of \$source or \$content must specified for apt_conf ${name}")
|
2010-10-24 15:07:34 +02:00
|
|
|
}
|
|
|
|
|
2012-04-09 07:33:13 +02:00
|
|
|
include apt::dot_d_directories
|
|
|
|
|
2012-04-09 07:39:29 +02:00
|
|
|
# One would expect the 'file' resource on sources.list.d to trigger an
|
|
|
|
# apt-get update when files are added or modified in the directory, but it
|
|
|
|
# apparently doesn't.
|
2010-10-25 06:14:33 +02:00
|
|
|
file { "/etc/apt/apt.conf.d/${name}":
|
|
|
|
ensure => $ensure,
|
2013-01-02 14:12:11 +01:00
|
|
|
owner => root,
|
|
|
|
group => 0,
|
|
|
|
mode => '0644',
|
2010-10-25 06:14:33 +02:00
|
|
|
}
|
|
|
|
|
2010-10-24 15:07:34 +02:00
|
|
|
if $source {
|
2010-10-25 06:14:33 +02:00
|
|
|
File["/etc/apt/apt.conf.d/${name}"] {
|
2010-10-24 15:07:34 +02:00
|
|
|
source => $source,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2010-10-25 06:14:33 +02:00
|
|
|
File["/etc/apt/apt.conf.d/${name}"] {
|
2010-10-24 15:07:34 +02:00
|
|
|
content => $content,
|
|
|
|
}
|
|
|
|
}
|
2013-02-01 11:01:23 +01:00
|
|
|
|
|
|
|
if $refresh_apt {
|
|
|
|
File["/etc/apt/apt.conf.d/${name}"] {
|
|
|
|
notify => Exec['refresh_apt'],
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-24 15:07:34 +02:00
|
|
|
}
|