From f16a0727dce187d07389388da8b816f7b520205d Mon Sep 17 00:00:00 2001 From: varac Date: Fri, 1 Feb 2013 11:01:23 +0100 Subject: Install unattended-upgrades after Exec[refresh_apt] Before, including apt::unattended_upgrades on a host without the unattended-upgrades package would fail on the first run, because the module tries to install the package before apt is finally configured. This commit does: - introduce the option $refresh_apt for apt::apt_conf (Defaults to true). Can be used to not trigger Exec['refresh_apt'] - install the unattended-upgrades package after a final Exec['refresh_apt']. To not run into a loop, it calls Apt_conf['50unattended-upgrades'] with the option refresh_apt => false, which is also not needed for the configuration --- manifests/unattended_upgrades.pp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'manifests/unattended_upgrades.pp') diff --git a/manifests/unattended_upgrades.pp b/manifests/unattended_upgrades.pp index c538831..b9d19c3 100644 --- a/manifests/unattended_upgrades.pp +++ b/manifests/unattended_upgrades.pp @@ -2,16 +2,21 @@ class apt::unattended_upgrades { package { 'unattended-upgrades': ensure => present, - require => undef, + require => Exec[refresh_apt] } apt_conf { '50unattended-upgrades': - source => [ - "puppet:///modules/site_apt/${::lsbdistcodename}/50unattended-upgrades", - 'puppet:///modules/site_apt/50unattended-upgrades', - "puppet:///modules/apt/${::lsbdistcodename}/50unattended-upgrades", - 'puppet:///modules/apt/50unattended-upgrades' ], - require => Package['unattended-upgrades'], + source => [ + "puppet:///modules/site_apt/${::lsbdistcodename}/50unattended-upgrades", + 'puppet:///modules/site_apt/50unattended-upgrades', + "puppet:///modules/apt/${::lsbdistcodename}/50unattended-upgrades", + 'puppet:///modules/apt/50unattended-upgrades' ], + require => Package['unattended-upgrades'], + refresh_apt => false + } + + Apt_conf['50unattended-upgrades'] { + notify => undef } if $apt::custom_preferences != false { -- cgit v1.2.3