]> gitweb.fluxo.info Git - puppet-apt.git/commitdiff
Fix apt::preferences::absent
authorGabriel Filion <lelutin@gmail.com>
Mon, 25 Oct 2010 16:17:50 +0000 (12:17 -0400)
committerGabriel Filion <lelutin@gmail.com>
Mon, 25 Oct 2010 18:15:12 +0000 (14:15 -0400)
Currently, setting the $custom_preferences variable to false fails
because of the /etc/apt/preferences concatenated_file being re-defined.

Fix this by setting dependencies on the resource only when we expect to
create the /etc/apt/preferences file. Also, since there is no "ensure"
parameter to concatenated_file, use a simple file resource to ensure
that it is removed.

Signed-off-by: Gabriel Filion <lelutin@gmail.com>
manifests/init.pp
manifests/preferences/absent.pp
manifests/preferences_snippet.pp
manifests/unattended_upgrades.pp

index 8588932165faf6c2afc0c3667a9bfeb99408d182..dde9c295e21ee0a649d26ce322b2d7a5ffcb26f7 100644 (file)
@@ -96,7 +96,11 @@ class apt {
       alias => "custom_keys",
       subscribe => File["${apt_base_dir}/keys.d"],
       refreshonly => true,
-      before => Concatenated_file[apt_config];
+    }
+    if $custom_preferences != false {
+      Exec["custom_keys"] {
+        before => Concatenated_file[apt_config],
+      }
     }
   }
 
index 3131aff9288f4cb0b026a072935a69775f3e5124..d8b2e10d50111bcf6bc80d3fe7efdcd536965a2d 100644 (file)
@@ -1,8 +1,5 @@
 class apt::preferences::absent {
-  include common::moduledir
-  $apt_preferences_dir = "${common::moduledir::module_dir_path}/apt/preferences"
-  concatenated_file{'/etc/apt/preferences':
-    dir => $apt_preferences_dir,
+  file {'/etc/apt/preferences':
     ensure => absent,
   }
 }
index a723206a1ad84e066362f8d52ebf223bce106269..9da7a8efb7c26ff80662445a49f4ffaf3948ae31 100644 (file)
@@ -4,6 +4,10 @@ define apt::preferences_snippet(
   $release,
   $priority
 ){
+  if $custom_preferences == false {
+    fail("Trying to define a preferences_snippet with \$custom_preferences set to false.")
+  }
+
   include apt::preferences
 
   file { "${apt::preferences::apt_preferences_dir}/${name}":
index fb041933a93315c1f359aa04e213e0ffbf3c192b..f52448d71d04c0e48ff76712622a44f0d7ed8bdb 100644 (file)
@@ -7,8 +7,12 @@ class apt::unattended_upgrades {
   apt_conf { "50unattended-upgrades":
     source  => ["puppet:///modules/site-apt/50unattended-upgrades",
                "puppet:///modules/apt/50unattended-upgrades" ],
-
-    before => Concatenated_file[apt_config],
     require => Package['unattended-upgrades'],
   }
+
+  if $custom_preferences != false {
+    Apt_conf["50unattended-upgrades"] {
+      before => Concatenated_file[apt_config],
+    }
+  }
 }