chef resource to be executed during compile time (1st phase)
Yesterday I had an issue with chef + vagrant. I was trying to use the following chef code:
package "make" chef_gem 'chef-handler-jenkins' require 'chef/handler/jenkins'
The "make" is required for chef-handler-jenkins because it wants to install libyajl2 which needs to compile something on the machine.
The problem is that the chef_gem resource is executed during the 1st phase, while the other resources like the package resource gets only executed in the 2nd phase, so chef_gem will fail due to the missing make command. The solution is quite simple. Force the package resource to run in the 1st phase and not in the 2nd phase.
So I changed the code as follows:
package "make" do action :nothing end.run_action(:install)
chef_gem 'chef-handler-jenkins'
require 'chef/handler/jenkins'
















