From e337a243897dfd5d009fc3937c69d3c814a84305 Mon Sep 17 00:00:00 2001 From: Daniel Paulus Date: Fri, 2 May 2014 23:35:54 +0200 Subject: [PATCH] Remove the preference file for all supported platforms when in purge mode --- manifests/init.pp | 24 +++++------------------- spec/classes/apt_spec.rb | 15 +-------------- 2 files changed, 6 insertions(+), 33 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index a55d584..c778b6f 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -54,18 +54,6 @@ class apt( true => "# Repos managed by puppet.\n", } - if $lsbdistcodename == 'wheezy' { - $preferences_content = undef - } - else { - $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, @@ -98,13 +86,11 @@ Package: bogus-package\n", notify => Exec['apt_update'], } - file { 'apt-preferences': - ensure => present, - path => "${root}/preferences", - owner => root, - group => root, - mode => '0644', - content => $preferences_content, + if $purge_preferences == true { + file { 'apt-preferences': + ensure => absent, + path => "${root}/preferences", + } } file { 'preferences.d': diff --git a/spec/classes/apt_spec.rb b/spec/classes/apt_spec.rb index 9f18a91..11d90cb 100644 --- a/spec/classes/apt_spec.rb +++ b/spec/classes/apt_spec.rb @@ -93,21 +93,8 @@ describe 'apt', :type => :class do 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, }) end } -- 2.45.2