I have a an old project I've built with chef (https://github.com/noha/virtual-gemstone). It uses chef together with vagrant to achieve its goal. The project was stale for the last couple of months and now I want to reactivate it. But I don't have much luck running it with chef 11. No matter what I try the values in attributes/default.rb aren't there. In the gemstone/attributes/default.rb file I have
default[:gemstone][:base_url] = "http://glass-downloads.gemstone.com/gss24"
default[:gemstone][:version] = "GemStone64Bit2.4.4.1-x86_64.Linux"
default[:gemstone][:dir] = "/opt/gemstone"
default[:gemstone][:log_dir] = "/opt/gemstone/log"
default[:gemstone][:lock_dir] = "/opt/gemstone/locks"
default[:gemstone][:user] = "gemstone"
default[:gemstone][:no_gems] = 3
default[:gemstone][:low_port] = 7000
default[:gemstone][:cache_path] = Chef::Config[:file_cache_path]
and in the gemstone/recipes/base.rb I have
...
tmp = node[:gemstone][:cache_path]
base_url = "#{node[:gemstone][:base_url]}"
file = "#{node[:gemstone][:version]}.zip"
dir = "#{node[:gemstone][:dir]}/#{node[:gemstone][:version]}"
...
but the values are always undefined/empty. I've tried even to set node.default in the attributes file and also while accessing the values in the recipe.
In order to test it I've copied all recipe .rb files into a single default.rb and added the content from the attributes file. This works but no it complains about a missing function that I've defined in gemstone/definitions/monit.rb called monit_gem.
The whole project was working months before. So I think there is something fundamentally wrong with my current setup for chef 11. But I couldn't find much that needs to be tweaked for this in order to work properly.
What might be the reason that attribute and definition files aren't read by chef?
I got it working with help from the opscode list. If include_recipe is used in recipes it is essential to put a depends statement in metadata.rb for the included recipe. Otherwise attributes, definitions and such are not read and therefor are not available inside the recipe.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With