From 666a05dea1856ef358edbc9929152983106c8970 Mon Sep 17 00:00:00 2001 From: Nan Liu Date: Mon, 7 May 2012 15:27:53 -0700 Subject: [PATCH] (#11966) apt module containment for apt_update. The update to separate Exec["apt-get update ${name}"] to single exec in apt::update class resulted in apt-get update command to be dangled. Previously if user specified Package['package_a'] <- Apt::Resource['source_a'], the original refactor would no longer guarantee apt-get update is executed before the package is installed. This patch fixes the problem using the anchor resource and ensuring the old behaviour is maintained and user can depend on apt-get update command being invoked if they specify dependency on any apt::* define resource type as well as the apt class. --- manifests/builddep.pp | 5 +++++ manifests/init.pp | 5 +++++ manifests/ppa.pp | 5 +++++ manifests/source.pp | 5 +++++ 4 files changed, 20 insertions(+) diff --git a/manifests/builddep.pp b/manifests/builddep.pp index f7537fb..ce9d8fd 100644 --- a/manifests/builddep.pp +++ b/manifests/builddep.pp @@ -9,4 +9,9 @@ define apt::builddep() { command => "/usr/bin/apt-get -y --force-yes build-dep ${name}", notify => Exec['apt_update'], } + + # Need anchor to provide containment for dependencies. + anchor { "apt::builddep::${name}": + require => Class['apt::update'], + } } diff --git a/manifests/init.pp b/manifests/init.pp index e41cd3f..0002589 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -94,4 +94,9 @@ class apt( notify => Exec['apt_update'], } } + + # Need anchor to provide containment for dependencies. + anchor { "apt::update": + require => Class['apt::update'], + } } diff --git a/manifests/ppa.pp b/manifests/ppa.pp index dd6ce19..7800d3d 100644 --- a/manifests/ppa.pp +++ b/manifests/ppa.pp @@ -35,5 +35,10 @@ define apt::ppa( ensure => file, require => Exec["add-apt-repository-${name}"]; } + + # Need anchor to provide containment for dependencies. + anchor { "apt::ppa::${name}": + require => Class['apt::update'], + } } diff --git a/manifests/source.pp b/manifests/source.pp index cbf2fd4..e55cafd 100644 --- a/manifests/source.pp +++ b/manifests/source.pp @@ -61,4 +61,9 @@ define apt::source( before => File["${name}.list"], } } + + # Need anchor to provide containment for dependencies. + anchor { "apt::source::${name}": + require => Class['apt::update'], + } } -- 2.45.2