diff options
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/dselect.pp | 2 | ||||
-rw-r--r-- | manifests/init.pp | 11 | ||||
-rw-r--r-- | manifests/update.pp | 12 | ||||
-rw-r--r-- | manifests/upgrade_package.pp | 36 |
4 files changed, 34 insertions, 27 deletions
diff --git a/manifests/dselect.pp b/manifests/dselect.pp index 45a5ddc..44f0e19 100644 --- a/manifests/dselect.pp +++ b/manifests/dselect.pp @@ -1,7 +1,7 @@ class apt::dselect { # suppress annoying help texts of dselect - append_if_no_such_line { dselect_expert: + line { dselect_expert: file => "/etc/dpkg/dselect.cfg", line => "expert", } diff --git a/manifests/init.pp b/manifests/init.pp index 7fa811d..b5be91f 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -142,15 +142,6 @@ class apt { command => '/usr/bin/apt-get update && sleep 1', refreshonly => true, subscribe => [ File['/etc/apt/apt.conf.d'], Config_file['/etc/apt/sources.list'] ]; - - 'update_apt': - command => '/usr/bin/apt-get update && /usr/bin/apt-get autoclean', - refreshonly => true, - require => [ File['/etc/apt/apt.conf.d', '/etc/apt/preferences' ], - Config_file['/etc/apt/sources.list'] ], - loglevel => info, - # Another Semaphor for all packages to reference - alias => "apt_updated"; } ## This package should really always be current @@ -170,7 +161,7 @@ class apt { mode => 0755, owner => root, group => root, } exec { "custom_keys": - command => "find ${apt_base_dir}/keys.d -type f -exec apt-key add '{}' \\; && apt-get update", + command => "find ${apt_base_dir}/keys.d -type f -exec apt-key add '{}' \\; && /usr/bin/apt-get update", subscribe => File["${apt_base_dir}/keys.d"], refreshonly => true, } diff --git a/manifests/update.pp b/manifests/update.pp new file mode 100644 index 0000000..ae992f4 --- /dev/null +++ b/manifests/update.pp @@ -0,0 +1,12 @@ +class apt::update { + + exec { 'update_apt': + command => '/usr/bin/apt-get update && /usr/bin/apt-get autoclean', + require => [ File['/etc/apt/apt.conf.d', '/etc/apt/preferences' ], + Config_file['/etc/apt/sources.list'] ], + loglevel => info, + # Another Semaphor for all packages to reference + alias => "apt_updated" + } + +} diff --git a/manifests/upgrade_package.pp b/manifests/upgrade_package.pp index 99e9c2a..8056286 100644 --- a/manifests/upgrade_package.pp +++ b/manifests/upgrade_package.pp @@ -1,20 +1,24 @@ define apt::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" ], - } - } + include apt::update + + $version_suffix = $version ? { + '' => '', + 'latest' => '', + default => "=${version}", + } + + package { ['apt-show-versions', 'dctrl-tools']: + ensure => installed, + require => undef, } + + exec { "aptitude -y 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'], + ], + } + } |