I'm attempting to add some custom code into the opsworks deploy cookbook, related to the before_migrate step:
before_migrate do
link_tempfiles_to_current_release
deploy_version = Time.now.strftime("%Y%m%d%H%M%S")
if node['deploy_app'] == 'web'
link "/var/lib/tomcat#{node["tomcat"]["base_version"]}/webapps/ROOT###{deploy_version}" do
to "#{release_path}"
end
The issue I'm having is when I include the deploy cookbook in my site-cookbook package, I get a chef error:
[2013-08-27T16:45:05+00:00] FATAL: Chef::Exceptions::ImmutableAttributeModification: ruby_block[Compile Custom OpsWorks Run List] (opsworks_custom_cookbooks::execute line 3) had an error: Chef::Exceptions::ImmutableAttributeModification: Node attributes are read-only when you do not specify which precedence level to set. To set an attribute use code like `node.default["key"] = "value"'
I've verified none of my cookbooks have incorrect node settings, so I'm out of ideas of what the issue could be. I'm finding this error very difficult to debug, and even when I include this cookbook without any modifications, I get this error. Please let me know if you can point me in the right direction.
In Chef, attributes have several precedence values, most often used are probably default and override. http://docs.opscode.com/chef_overview_attributes.html You have to find where you are setting an attribute by specifying only node['something']. It doesn;t seem to be in the code you pasted.