Closed spuder closed 8 years ago
Thanks
It too late now, but I might have found a work around as mentioned in this ticket. https://github.com/SimpleFinance/chef-zookeeper/pull/153
Putting this in the role/wrapper cookbook might have caused apt to update before the 'patch' resource was installed.
default['apt']['compile_time_update'] = true
@spuder while that would have worked around this, your suggestion in #26 was a far better solution. Avoiding doing things during compilation is a Good Thing™.
I thought I had this fixed, but I was mistaken. Because this cookbook (and the zookeeper cookbook) both depend on build-essential cookbook, and the build-essential cookbook does the same thing where it installs packages in the compilation phase, the problem remains.
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
---- End output of apt-get -q -y install build-essential=11.6ubuntu6 ----
Ran apt-get -q -y install build-essential=11.6ubuntu6 returned 100
Cookbook Trace:
---------------
/tmp/kitchen/cookbooks/build-essential/libraries/timing.rb:113:in `each'
/tmp/kitchen/cookbooks/build-essential/libraries/timing.rb:113:in `method_missing'
/tmp/kitchen/cookbooks/build-essential/recipes/_debian.rb:24:in `block in from_file'
/tmp/kitchen/cookbooks/build-essential/libraries/timing.rb:104:in `instance_eval'
/tmp/kitchen/cookbooks/build-essential/libraries/timing.rb:104:in `evaluate'
/tmp/kitchen/cookbooks/build-essential/libraries/timing.rb:47:in `potentially_at_compile_time'
/tmp/kitchen/cookbooks/build-essential/recipes/_debian.rb:20:in `from_file'
/tmp/kitchen/cookbooks/build-essential/recipes/default.rb:21:in `from_file'
/tmp/kitchen/cookbooks/zookeeper/recipes/install.rb:32:in `from_file'
/tmp/kitchen/cookbooks/exhibitor/recipes/default.rb:24:in `from_file'
Relevant File Content:
----------------------
/tmp/kitchen/cookbooks/build-essential/libraries/timing.rb:
107: def method_missing(m, *args, &block)
109: if resource.is_a?(Chef::Resource)
110: actions = Array(resource.action)
111: resource.action(:nothing)
112:
113: actions.each do |action|
114>> resource.run_action(action)
115: end
116: end
117: resource
118: end
120: end
121: end
122:
123: # Include the timing module into the main recipe DSL
I think the only course of action is to either change the build-essential cookbook to install during execution phase (to be honest, I don't want to go down that rabbit hole), Or document apt.compile_time_update = true in the readme.
Not sure why others aren't hitting this problem. Maybe they use aws and the instances always have a recent apt cache.
@spuder thankfully, I’m shipping a new release of the zookeeper
cookbook very shortly that sets this node['apt']['compile_time'] = true
. I’ll also add it to this cookbook, to cover the potential future eventuality where this cookbook is decoupled from zookeeper
. Stand by!
@spuder ok, zookeeper
v3.0.1 should do the trick for you.
Excellent. Thanks so much. Just tested 3.0.1 in testkitchen and it indeed did work properly.
If you attempt to install chef-exhibitor, it needs to install 'patch'.
Because the cookbook uses
end.run_action(:install)
on the 'patch' installation resource, this makes it so that the patch resource is installed before anything else.This causes a big problem if you haven't run
apt-get update
yet. Adding the 'apt' resource to your run list won't work around the issue because theend.run_action(:install)
short circuits the run list completely, making it impossible to run apt first.Additional information on why
end.run_action(:install)
causes problems.https://www.chef.io/blog/2013/09/04/demystifying-common-idioms-in-chef-recipes/ https://gist.github.com/spuder/42e9b94bf557520458fa#file-output-txt-L279
Unless there is a real need for this, I think it should be taken out and the 'patch' resource should just be installed during the normal execution run.
I haven't been able to find a work around to this issue besides ssh-ing into each node one by one and running apt-get update before provisioning.