]> review.fuel-infra Code Review - puppet-modules/puppetlabs-apt.git/commitdiff
(#11966) apt module containment for apt_update.
authorNan Liu <nan@puppetlabs.com>
Mon, 7 May 2012 22:27:53 +0000 (15:27 -0700)
committerNan Liu <nan@puppetlabs.com>
Mon, 7 May 2012 22:27:53 +0000 (15:27 -0700)
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
manifests/init.pp
manifests/ppa.pp
manifests/source.pp

index f7537fbb251dc0ab6cf5d0c605b0509ea9880953..ce9d8fd6302ac02b4ba75e82539cc3fdfc71d101 100644 (file)
@@ -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'],
+  }
 }
index e41cd3fdee7514b6373603d917638e3a77dbd28e..00025893689835f8b1eef17f7202d65327579fda 100644 (file)
@@ -94,4 +94,9 @@ class apt(
       notify  => Exec['apt_update'],
     }
   }
+
+  # Need anchor to provide containment for dependencies.
+  anchor { "apt::update":
+    require => Class['apt::update'],
+  }
 }
index dd6ce19e8ed8d95f466c3c311ad2f14a0ccc4e54..7800d3d388fd9efb714aa98e59df02fae1fb6e8a 100644 (file)
@@ -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'],
+  }
 }
 
index cbf2fd4566ae43bf9312156ef14a88161a7f7eb1..e55cafdfd1f4fbb493247f88b5a497270eec743e 100644 (file)
@@ -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'],
+  }
 }