- From: Kevin Nuckolls <
>
- To: chef <
>
- Subject: [chef] Re: chef_gem execution order
- Date: Thu, 1 May 2014 23:19:06 -0500
Hi David,
The quick fix is to make sure apt is updated before these recipes run during compile phase instead of convergence phase.
You may not be willing to go all the way down the road I went down to solve this problem and a host of similar problems just like it but I'll go over it. Basically, I started using Packer to create my very own basebox image and I completely restructured our basebox recipes to be separated into an "image" recipe and a "postlaunch" recipe. After two years of headaches with apt here and there I have come to the conclusion that it just solves a lot of problems by removing apt-get update from the chef-run completely and making sure that it's up to date in the image before the run. For the specific example of fog being installed at compile time instead of converge time I just made sure in my basebox "image" had fog and all the libxml2 / nokogiri dependencies installed correctly. That way when other cookbooks expect them, they're already there. In my experience this lessens the number of apt-based edge cases to debug when you just want to slam out a wrapper cookbook.
There is one exception. If a recipe adds a repository, the apt cookbook can / should be notified to perform an apt-get update. Personally, I'd prefer for that to happen exactly once. If nodes start to fail because their apt is old, or it's just time to do an apt-get upgrade then it's probably actually time to shoot those nodes in the head and roll out new ones on freshly cut baseboxes. That or you run sudo apt-get update with knife ssh and re-run chef client and you're back in business.
This is just my current philosophy on the matter. I haven't been all the way down the rabbit hole to see where this particular paradigm breaks down. That said, thus far I greatly prefer it to trying to always start from a vanilla ubuntu install.
Hope this helps.
Best Regards,
-Kevin
Archive powered by MHonArc 2.6.16.