我嘗試添加一些自定義代碼到opsworks部署菜譜,相關before_migrate步:使用修改opsworks部署食譜不可變對象錯誤
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
我遇到的問題是,當我包括在我的網站的菜譜包部署菜譜,我得到一個廚師的錯誤:我的食譜
[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"'
我已經驗證無有不正確的節點設置,所以我出什麼樣的問題可能是想法。我發現這個錯誤非常難以調試,甚至當我沒有任何修改的情況下包含這本烹飪書時,我得到這個錯誤。請讓我知道你是否可以指引我正確的方向。