aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvarac <varacanero@zeromail.org>2012-12-19 09:40:53 +0100
committervarac <varacanero@zeromail.org>2012-12-19 09:40:53 +0100
commitffb44c91db24d30bb9584eb27d52f76958d6b732 (patch)
tree5d3e4e2c755c14e7a9e95dbb89615f8fbd0c0367
parent0d5311b1a9fa82e4e423a9e7ce7f5eb919bab40d (diff)
parent3a473dafd5887cb77b0b764dd951d9581b69f160 (diff)
downloadpuppet-apt-ffb44c91db24d30bb9584eb27d52f76958d6b732.tar.gz
puppet-apt-ffb44c91db24d30bb9584eb27d52f76958d6b732.tar.bz2
Merge branch 'master' of git://labs.riseup.net/shared-apt
-rw-r--r--README9
-rw-r--r--manifests/dist_upgrade.pp4
-rw-r--r--manifests/init.pp5
-rw-r--r--manifests/upgrade_package.pp13
4 files changed, 25 insertions, 6 deletions
diff --git a/README b/README
index be80c62..1d43284 100644
--- a/README
+++ b/README
@@ -155,6 +155,15 @@ $apt_repos
If this variable is set the default repositories list ("main contrib non-free")
is overriden.
+$apt_disable_update
+-------------------
+
+Disable "apt-get update" which is normally triggered by apt::upgrade_package
+and apt::dist_upgrade.
+Note that nodes can be updated once a day by using
+ APT::Periodic::Update-Package-Lists "1";
+in i.e. /etc/apt/apt.conf.d/80_apt_update_daily.
+
Classes
=======
diff --git a/manifests/dist_upgrade.pp b/manifests/dist_upgrade.pp
index 9e26769..47b1cff 100644
--- a/manifests/dist_upgrade.pp
+++ b/manifests/dist_upgrade.pp
@@ -1,6 +1,8 @@
class apt::dist_upgrade {
- include apt::update
+ if $apt::disable_update == false {
+ include apt::update
+ }
exec { 'apt_dist-upgrade':
command => "/usr/bin/apt-get -q -y -o 'DPkg::Options::=--force-confold' dist-upgrade",
diff --git a/manifests/init.pp b/manifests/init.pp
index 2ae691f..794347f 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -40,6 +40,11 @@ class apt {
'' => 'http://archive.ubuntu.com/ubuntu',
default => "${apt_ubuntu_url}",
}
+ $disable_update = $apt_disable_update ? {
+ '' => false,
+ default => $apt_disable_update
+ }
+
case $operatingsystem {
'debian': {
$repos = $apt_repos ? {
diff --git a/manifests/upgrade_package.pp b/manifests/upgrade_package.pp
index 9202624..2ce6932 100644
--- a/manifests/upgrade_package.pp
+++ b/manifests/upgrade_package.pp
@@ -1,6 +1,8 @@
define apt::upgrade_package ($version = "") {
- include apt::update
+ if $apt::disable_update == false {
+ include apt::update
+ }
$version_suffix = $version ? {
'' => '',
@@ -24,10 +26,11 @@ define apt::upgrade_package ($version = "") {
exec { "apt-get -q -y -o 'DPkg::Options::=--force-confold' install ${name}${version_suffix}":
onlyif => [ "grep-status -F Status installed -a -P $name -q", "apt-show-versions -u $name | grep -q upgradeable" ],
- require => [
- Exec['apt_updated'],
- Package['apt-show-versions', 'dctrl-tools'],
- ],
+ require => $apt::disable_update ? {
+ true => Package['apt-show-versions', 'dctrl-tools'],
+ default => [ Exec['apt_updated'],
+ Package['apt-show-versions', 'dctrl-tools'] ],
+ }
}
}