summaryrefslogtreecommitdiff
path: root/puppet/modules/apt/manifests/upgrade_package.pp
diff options
context:
space:
mode:
Diffstat (limited to 'puppet/modules/apt/manifests/upgrade_package.pp')
m---------puppet/modules/apt0
-rw-r--r--puppet/modules/apt/manifests/upgrade_package.pp31
2 files changed, 31 insertions, 0 deletions
diff --git a/puppet/modules/apt b/puppet/modules/apt
deleted file mode 160000
-Subproject 33c61e8df59db1abbed379a9e9790946060a8f1
diff --git a/puppet/modules/apt/manifests/upgrade_package.pp b/puppet/modules/apt/manifests/upgrade_package.pp
new file mode 100644
index 00000000..30572c96
--- /dev/null
+++ b/puppet/modules/apt/manifests/upgrade_package.pp
@@ -0,0 +1,31 @@
+define apt::upgrade_package (
+ $version = ''
+) {
+
+ $version_suffix = $version ? {
+ '' => '',
+ 'latest' => '',
+ default => "=${version}",
+ }
+
+ if !defined(Package['apt-show-versions']) {
+ package { 'apt-show-versions':
+ ensure => installed,
+ require => undef,
+ }
+ }
+
+ if !defined(Package['dctrl-tools']) {
+ package { 'dctrl-tools':
+ ensure => installed,
+ require => undef,
+ }
+ }
+
+ 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 => Package['apt-show-versions', 'dctrl-tools'],
+ before => Exec['apt_updated']
+ }
+
+}