Install required_packages before 'apt-get update'
authorFrancois Deppierraz <francois@ctrlaltdel.ch>
Mon, 3 Jun 2013 09:57:58 +0000 (09:57 +0000)
committerFrancois Deppierraz <francois@ctrlaltdel.ch>
Mon, 3 Jun 2013 09:57:58 +0000 (09:57 +0000)
This is necessary when required_packages contains GPG keys that are used for
authenticating other packages. Tested with package ubuntu-cloud-keyring which
is included in Ubuntu main and used by the Ubuntu Cloud Archive.

I think the same problem applies to other *-keyring packages as well.

manifests/source.pp
spec/defines/source_spec.rb

index a859174a1aaef9296a74bc8ec8c6acd51d096f1a..9a358fe29c972e27a6cc9d8972f30d4c83e6c0ec 100644 (file)
@@ -61,6 +61,7 @@ define apt::source(
       logoutput   => 'on_failure',
       refreshonly => true,
       subscribe   => File["${name}.list"],
+      before      => Exec['apt_update'],
     }
   }
 
index 0f37f6367bcbd761d966fe448caf18ea9dd71163..32aa6c8dcb11d8ceae4c74857c5320acacdd50b0 100644 (file)
@@ -114,7 +114,8 @@ describe 'apt::source', :type => :define do
           should contain_exec("Required packages: '#{param_hash[:required_packages]}' for #{title}").with({
             "command" => "/usr/bin/apt-get -y install #{param_hash[:required_packages]}",
             "subscribe"   => "File[#{title}.list]",
-            "refreshonly" => true
+            "refreshonly" => true,
+            "before"      => 'Exec[apt_update]',
           })
         else
           should_not contain_exec("Required packages: '#{param_hash[:required_packages]}' for #{title}").with({