- From: Bryan McLellan <
>
- To:
- Subject: [chef] Re: Re: Re: sun java install apt-get update
- Date: Thu, 28 Apr 2011 11:04:05 -0700
On Thu, Apr 28, 2011 at 10:26 AM, Haselwanter Edmund
<
>
wrote:
>
>
On Thursday, April 28, 2011 at 7:21 AM, Haselwanter Edmund wrote:
>
>
>
> [Thu, 28 Apr 2011 13:50:17 +0000] INFO: Setting mode to 644 for
>
> file[/etc/apt/sources.list.d/ubuntu-partner-source.list]
>
> [Thu, 28 Apr 2011 13:50:38 +0000] ERROR: apt_repository[ubuntu-partner]
>
> (/var/chef-solo/cookbooks/java/recipes/sun.rb:32:in `from_file') had an
>
> error:
>
> apt-get update returned 100, expected 0
>
>
it seems they did a update on the ubuntu partner apt_repo. running it
>
manually on the commandline worked without a problem.
If there is an issue with a repository, such as a timeout or a key
problem, "apt-get update" will exit with 100.
When running a periodic apt-get update, I tend to ignore failure:
execute "apt-get-update" do
ignore_failure true
command "apt-get update"
end
Note that ignore_failure supersedes the old attribute epic_fail.
It might look a little more correct to specify that you expect specific
failure:
execute "apt-get-update" do
returns [0, 100]
command "apt-get update"
end
When you do add keys or a new repository, you can't do this because
you need to be sure the changes occurred. In the past, I've used
Ubuntu's update-notifier framework to handle updating the apt cache.
# Run apt-get update to create the stamp file
execute "apt-get-update" do
ignore_failure true
command "apt-get update"
not_if do File.exists?('/var/lib/apt/periodic/update-success-stamp') end
end
# provides /var/lib/apt/periodic/update-success-stamp on apt-get update
package "update-notifier-common" do
ignore_failure true
notifies :run, resources(:execute => "apt-get-update"), :immediately
end
execute "apt-get-update-periodic" do
epic_fail true
command "apt-get update"
only_if do
File.exists?('/var/lib/apt/periodic/update-success-stamp') &&
File.mtime('/var/lib/apt/periodic/update-success-stamp') < Time.now -
86400
end
end
Bryan
Archive powered by MHonArc 2.6.16.