]> gitweb.fluxo.info Git - puppet-apt.git/commitdiff
Set dselect DSelect::Clean to 'pre-auto' by default for hosts that are vservers.
authorMicah Anderson <micah@riseup.net>
Tue, 7 Dec 2010 17:20:14 +0000 (12:20 -0500)
committerMicah Anderson <micah@riseup.net>
Tue, 7 Dec 2010 17:20:14 +0000 (12:20 -0500)
Before you only had the choice of setting a 03clean apt configuration for either
all hosts, or every single host. Setting it to have the recommended settings for
vservers for all hosts meant that you were setting it for non-vservers as well
as vservers. The other option you had was to set it per host. This was a bit
annoying if you have any more than one vserver because you would need to create
a 03clean for every single vserver guest.

This change auto-detects if the node is a vserver, and if it is it automatically
installs the 03clean_vserver file, with the recommended DSelect::Clean settings,
and allows you to override this for all of your vservers, or for specific hosts.

README
files/03clean_vserver [new file with mode: 0644]
manifests/init.pp

diff --git a/README b/README
index 4c5e72794cb1058900ccca7e78939f16a3e72439..8118d3cb0259c3c6b44c754d980ad4c5ddfffe43 100644 (file)
--- a/README
+++ b/README
@@ -20,10 +20,10 @@ This module needs:
 - lsb-release installed
 - the common module: git://labs.riseup.net/shared-common
 
-By default, this module sets the configuration option DSelect::Clean to 'auto'.
-It is the recommended value on normal hosts.  On virtual servers, the
-recommended value is 'pre-auto', since virtual servers are usually more
-space-bound and have better recovery mechanisms via the host:
+By default, on normal hosts, this module sets the configuration option
+DSelect::Clean to 'auto'. On virtual servers, the value is set by default to
+'pre-auto', because virtual servers are usually more space-bound and have better
+recovery mechanisms via the host:
 
 From apt.conf(5), 0.7.2:
      "Cache Clean mode; this value may be one of always, prompt, auto,
@@ -35,10 +35,11 @@ From apt.conf(5), 0.7.2:
      packages."
 
 To change the default setting for DSelect::Clean, you can create a file named
-"03clean" in a site-apt module's files directory. You can also define this for
-a specific host by creating a file in a subdirectory of the site-apt modules'
-files directory that is named the same as the host. (example:
-site-apt/files/some.host.com/03clean)
+"03clean" or "03clean_vserver" in your site-apt module's files directory. You
+can also define this for a specific host by creating a file in a subdirectory of
+the site-apt modules' files directory that is named the same as the
+host. (example: site-apt/files/some.host.com/03clean, or
+site-apt/files/some.host.com/03clean_vserver)
 
 Variables
 =========
diff --git a/files/03clean_vserver b/files/03clean_vserver
new file mode 100644 (file)
index 0000000..6bb84e5
--- /dev/null
@@ -0,0 +1,4 @@
+// This file is managed by Puppet
+// all local modifications will be overwritten
+
+DSelect::Clean pre-auto;
index 3f2a523a1cab20b6b47c1567eddf1e7165044631..179b4d81f8ed7224a50f6ad984b4cb18d4a0db64 100644 (file)
@@ -93,12 +93,21 @@ class apt {
                "puppet:///modules/apt/02show_upgraded"]
   }
 
-  apt_conf { "03clean":
-    source => ["puppet:///modules/site-apt/${fqdn}/03clean",
-               "puppet:///modules/site-apt/03clean",
-               "puppet:///modules/apt/03clean"]
+  if ( $virtual == "vserver" ) {
+    apt_conf { "03clean_vserver":
+      source => ["puppet:///modules/site-apt/${fqdn}/03clean_vserver",
+                 "puppet:///modules/site-apt/03clean_vserver",
+                 "puppet:///modules/apt/03clean_vserver"]
+    }
   }
-
+  else {
+    apt_conf { "03clean":
+      source => ["puppet:///modules/site-apt/${fqdn}/03clean",
+                 "puppet:///modules/site-apt/03clean",
+                 "puppet:///modules/apt/03clean"]
+    }
+  }
+    
   case $custom_preferences {
     false: {
       include apt::preferences::absent