]> gitweb.fluxo.info Git - puppet-apt.git/commitdiff
Introducing $apt_update_method
authorSilvio Rhatto <rhatto@riseup.net>
Sat, 2 Jan 2010 13:11:35 +0000 (11:11 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Sat, 2 Jan 2010 13:11:35 +0000 (11:11 -0200)
manifests/init.pp

index 9ef9768afdaeb80294a408412a6f2472f75c2b93..a791a371e6a9186b9bc0c41d5211014aee480055 100644 (file)
@@ -16,6 +16,11 @@ class apt {
                default => $backports_enabled,
        }
 
+  $apt_update_method = $apt_update_method {
+    ''      => 'exec',
+    default => $apt_update_method,
+  }
+
        package { apt: ensure => installed }
 
        # a few templates need lsbdistcodename
@@ -83,13 +88,25 @@ class apt {
                        refreshonly => true,
                        subscribe => [ File["/etc/apt/sources.list"],
                                File["/etc/apt/preferences"], File["/etc/apt/apt.conf.d"],
-                               File[apt_config] ];
-               "/usr/bin/apt-get update && /usr/bin/apt-get autoclean #hourly":
-                       require => [ File["/etc/apt/sources.list"],
-                               File["/etc/apt/preferences"], File[apt_config] ],
-                       # Another Semaphor for all packages to reference
-                       alias => apt_updated;
-       }
+                               File[apt_config] ],
+  }
+
+  if $apt_update_method == 'exec' {
+    exec { "/usr/bin/apt-get update && /usr/bin/apt-get autoclean #hourly":
+      require => [ File["/etc/apt/sources.list"], File["/etc/apt/preferences"], File[apt_config] ],
+      # Another Semaphor for all packages to reference
+      alias => apt_updated,
+       }
+  } else {
+    cron { "apt_updated":
+      command  => "/usr/bin/apt-get update && /usr/bin/apt-get autoclean #hourly &> /dev/null",
+      user     => root,
+      hour     => "*/1",
+      minute   => "0",
+      ensure   => present,
+      require => [ File["/etc/apt/sources.list"], File["/etc/apt/preferences"], File[apt_config] ],
+    }
+  }
              
        ## This package should really always be current
        package { "debian-archive-keyring":