From 8a02e814ee8dd1fa608bcde0942dae6e9663437b Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sat, 2 Jan 2010 11:11:35 -0200 Subject: Introducing $apt_update_method --- manifests/init.pp | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'manifests/init.pp') diff --git a/manifests/init.pp b/manifests/init.pp index 9ef9768..a791a37 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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": -- cgit v1.2.3