* Your system's `preferences` file and `preferences.d` directory
* Your system's `sources.list` file and `sources.list.d` directory
+* Your system's `apt.conf.d` directory
* System repositories
* Authentication keys
-**Note:** This module offers `purge` parameters which, if set to `true`, **destroy** any configuration on the node's `sources.list(.d)` and `preferences(.d)` that you haven't declared through Puppet. The default for these parameters is `false`.
+**Note:** This module offers `purge` parameters which, if set to `true`, **destroy** any configuration on the node's `sources.list(.d)`, `preferences(.d)` and `apt.conf.d` that you haven't declared through Puppet. The default for these parameters is `false`.
<a id="beginning-with-apt"></a>
### Beginning with apt
String $conf_d = $apt::params::conf_d,
String $preferences = $apt::params::preferences,
String $preferences_d = $apt::params::preferences_d,
+ String $apt_conf_d = $apt::params::apt_conf_d,
Hash $config_files = $apt::params::config_files,
Hash $source_key_defaults = $apt::params::source_key_defaults,
) inherits apt::params {
if $purge['preferences.d'] {
assert_type(Boolean, $purge['preferences.d'])
}
+ if $purge['apt.conf.d'] {
+ assert_type(Boolean, $purge['apt.conf.d'])
+ }
$_purge = merge($::apt::purge_defaults, $purge)
$_proxy = merge($apt::proxy_defaults, $proxy)
notify => Class['apt::update'],
}
+ file { 'apt.conf.d':
+ ensure => directory,
+ path => $::apt::apt_conf_d,
+ owner => root,
+ group => root,
+ mode => '0644',
+ purge => $_purge['apt.conf.d'],
+ recurse => $_purge['apt.conf.d'],
+ notify => Class['apt::update'],
+ }
+
if $confs {
create_resources('apt::conf', $confs)
}
$conf_d = "${root}/apt.conf.d"
$preferences = "${root}/preferences"
$preferences_d = "${root}/preferences.d"
+ $apt_conf_d = "${root}/apt.conf.d"
$keyserver = 'keyserver.ubuntu.com'
$key_options = undef
$confs = {}
'sources.list.d' => false,
'preferences' => false,
'preferences.d' => false,
+ 'apt.conf.d' => false,
}
$source_key_defaults = {
'sources.list.d' => true,
'preferences' => true,
'preferences.d' => true,
+ 'apt.conf.d' => true,
},
sources => $sources,
}
recurse: false,
notify: 'Class[Apt::Update]' }
+apt_conf_d = { ensure: 'directory',
+ path: '/etc/apt/apt.conf.d',
+ owner: 'root',
+ group: 'root',
+ mode: '0644',
+ purge: false,
+ recurse: false,
+ notify: 'Class[Apt::Update]' }
+
describe 'apt' do
let(:facts) do
{
is_expected.to contain_file('preferences.d').that_notifies('Class[Apt::Update]').only_with(preferences_d)
}
+ it {
+ is_expected.to contain_file('apt.conf.d').that_notifies('Class[Apt::Update]').only_with(apt_conf_d)
+ }
+
it { is_expected.to contain_file('/etc/apt/auth.conf').with_ensure('absent') }
it 'lays down /etc/apt/apt.conf.d/15update-stamp' do
{
update: { 'frequency' => 'always', 'timeout' => 1, 'tries' => 3 },
purge: { 'sources.list' => false, 'sources.list.d' => false,
- 'preferences' => false, 'preferences.d' => false },
+ 'preferences' => false, 'preferences.d' => false,
+ 'apt.conf.d' => false },
}
end
recurse: false)
}
+ it {
+ is_expected.to contain_file('apt.conf.d').with(purge: false,
+ recurse: false)
+ }
+
it {
is_expected.to contain_exec('apt_update').with(refreshonly: false,
timeout: 1,
is_expected.to raise_error(Puppet::Error)
end
end
+
+ context "with purge['apt.conf.d']=>'banana'" do
+ let(:params) { { purge: { 'apt.conf.d' => 'banana' } } }
+
+ it do
+ is_expected.to raise_error(Puppet::Error)
+ end
+ end
end
end