]> review.fuel-infra Code Review - puppet-modules/puppetlabs-apt.git/commitdiff
Remove the preference file for all supported platforms when in purge mode
authorDaniel Paulus <daniel@inuits.eu>
Fri, 2 May 2014 21:35:54 +0000 (23:35 +0200)
committerDaniel Paulus <daniel@inuits.eu>
Fri, 2 May 2014 21:35:54 +0000 (23:35 +0200)
manifests/init.pp
spec/classes/apt_spec.rb

index a55d584a1324469fec3d33ac6cc6619262f98f3d..c778b6fd4b17c0fe66344277edf0a4169c00adbc 100644 (file)
@@ -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':
index 9f18a9126454ae1e2807117dd6d24305c2e4166a..11d90cb57195132f11acbaf44416097525e7f469 100644 (file)
@@ -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
       }