fnichol / chef-rvm_passenger

Chef cookbook which installs the Passenger gem via RVM and configures Apache or nginx.
http://fnichol.github.com/chef-rvm_passenger/
32 stars 59 forks source link

nil value being passed to apache_module #18

Open chaoranxie opened 11 years ago

chaoranxie commented 11 years ago

in rvm_passenger:: apache2 (https://github.com/fnichol/chef-rvm_passenger/blob/master/recipes/apache2.rb#L74)

you can see that we are using apache_module definition and passing it node['rvm_passenger']['module_path'] value which is calculated in a ruby block before.

It turns out that node attribute is nill, when the apache_module resource is constructed, which indirectly is throw a error when i try to use this recipe on centos6.

I dont know exactly how each resource is elevated and how one resource might be able to use that node attribute computed by another resource. ( if there is a blog post somewhere let me know).

I did a quick test to show the idea, ideally, in the end of the code run i should see the /tmp/test file contain the content "This is a secret" but it turns out the file contains nothing. it seems that this has to do with the order of things being run.


ruby_block "Calculate secret" do
  block do
    node.set['secret_message'] = "This is a secret"
  end
end

file "/tmp/test" do
  content "#{node['secret_message']}"
  mode 0644
end

chaoranxie commented 11 years ago

currently i had to hack out the apache2 recipe to use following line, this is definitely not idea and i am sure it is breaking a bunch of other things.

apache_module "passenger" do
        module_path "/usr/local/rvm/gems/ruby-1.9.3-p194@passenger/gems/passenger-3.0.18/ext/apache2/mod_passenger.so"
end