**What APT affects:**
* package/service/configuration files for APT
+ * NOTE: Setting the `purge_preferences` or `purge_preferences_d` parameters to 'true' will destroy any existing configuration that was not declared with puppet. The default for these parameters is 'false'.
* your system's `sources.list` file and `sources.list.d` directory
* NOTE: Setting the `purge_sources_list` and `purge_sources_list_d` parameters to 'true' will destroy any existing content that was not declared with Puppet. The default for these parameters is 'false'.
* system repositories
Puppet will manage your system's `sources.list` file and `sources.list.d` directory but will do its best to respect existing content.
-If you declare your apt class with `purge_sources_list` and `purge_sources_list_d` set to 'true', Puppet will unapologetically purge any existing content it finds that wasn't declared with Puppet.
+If you declare your apt class with `purge_sources_list`, `purge_sources_list_d`, `purge_preferences` and `purge_preferences_d` set to 'true', Puppet will unapologetically purge any existing content it finds that wasn't declared with Puppet.
### apt::builddep
* William Van Hevelingen <blkperl@cat.pdx.edu> <wvan13@gmail.com>
* Zach Leslie <zach@puppetlabs.com>
* Daniele Sluijters <github@daenney.net>
+* Daniel Paulus <daniel@inuits.eu>
true => "# Repos managed by puppet.\n",
}
- $preferences_content = $purge_preferences ? {
- false => undef,
- true => "Explanation: Preferences managed by Puppet\n
-Explanation: We need a bogus package line because of Debian Bug #732746\n
-Package: bogus-package\n",
- }
-
if $always_apt_update == true {
Exec <| title=='apt_update' |> {
refreshonly => false,
notify => Exec['apt_update'],
}
- file { 'apt-preferences':
- ensure => present,
- path => "${root}/preferences",
- owner => root,
- group => root,
- mode => '0644',
- content => $preferences_content,
+ if $purge_preferences {
+ file { 'apt-preferences':
+ ensure => absent,
+ path => "${root}/preferences",
+ }
}
file { 'preferences.d':
end
describe file('/etc/apt/preferences') do
- it { should be_file }
- it 'is managed by Puppet' do
- shell("grep 'Explanation' /etc/apt/preferences", {:acceptable_exit_codes => 0})
- end
+ it { should_not be_file }
end
end
end
--- /dev/null
+HOSTS:
+ debian-73-x64:
+ roles:
+ - master
+ platform: debian-7-amd64
+ box : debian-73-x64-virtualbox-nocm
+ box_url : http://puppet-vagrant-boxes.puppetlabs.com/debian-73-x64-virtualbox-nocm.box
+ hypervisor : vagrant
+CONFIG:
+ log_level: debug
+ type: git
\ No newline at end of file
it {
if param_hash[:purge_preferences]
should create_file('apt-preferences').with({
- :ensure => 'present',
+ :ensure => 'absent',
:path => '/etc/apt/preferences',
- :owner => 'root',
- :group => 'root',
- :mode => '0644',
- :content => /Explanation/,
})
else
- should create_file('apt-preferences').with({
- :ensure => 'present',
- :path => '/etc/apt/preferences',
- :owner => 'root',
- :group => 'root',
- :mode => '0644',
- :content => nil,
- })
+ should_not contain_file('apt-preferences')
end
}