aboutsummaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
authorMicah Anderson <micah@riseup.net>2008-09-29 14:36:28 -0400
committerMicah Anderson <micah@riseup.net>2008-09-29 14:36:28 -0400
commit91a49f53c49a6edcad6ceb5152c069cc998a263d (patch)
treeae22f5062f62e160ac435601cf943be3507ea199 /manifests
parentdd8e529538558cc24cdaba7514a1b2e75f464fa0 (diff)
downloadpuppet-apt-91a49f53c49a6edcad6ceb5152c069cc998a263d.tar.gz
puppet-apt-91a49f53c49a6edcad6ceb5152c069cc998a263d.tar.bz2
add the upgrade_package define
This simplifies upgrades for DSA security announcements or point-releases. This will ensure that the named package is upgrade to the version specified, only if the package is installed, otherwise nothing happens. If the specified version is 'latest' (the default), then the package is ensured to be upgraded to the latest package revision when it becomes available. For example, the following upgrades the perl package to version 5.8.8-7etch1 (if it is installed), it also upgrades the syslog-ng and perl-modules packages to their latest (also, only if they are installed): upgrade_package { "perl": version => '5.8.8-7etch1'; "syslog-ng": version => latest; "perl-modules": }
Diffstat (limited to 'manifests')
-rw-r--r--manifests/init.pp20
1 files changed, 20 insertions, 0 deletions
diff --git a/manifests/init.pp b/manifests/init.pp
index 77d5a7f..85911bc 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -181,6 +181,26 @@ class apt {
require => File[$seedfile],
}
}
+
+ define upgrade_package ($version = "") {
+ case $version {
+ '': {
+ exec { "aptitude -y install $name":
+ onlyif => [ "grep-status -F Status installed -a -P $name -q", "apt-show-versions -u $name | grep -q upgradeable" ],
+ }
+ }
+ 'latest': {
+ exec { "aptitude -y install $name":
+ onlyif => [ "grep-status -F Status installed -a -P $name -q", "apt-show-versions -u $name | grep -q upgradeable" ],
+ }
+ }
+ default: {
+ exec { "aptitude -y install $name=$version":
+ onlyif => [ "grep-status -F Status installed -a -P $name -q", "apt-show-versions -u $name | grep -q upgradeable" ],
+ }
+ }
+ }
+ }
}
class dselect {