【发布时间】:2014-01-03 16:11:54
【问题描述】:
我正在尝试创建一个取决于 tomcat 食谱的厨师食谱,例如
tomcat_user = node[:tomcat][:user]
tomcat_user_home_folder = node[:etc][:passwd][tomcat_user][:dir]
execute "Install jasper license" do
command "cp jasperserver.license #{tomcat_user_home_folder}/"
cwd "#{node["install-jasper-license"]["license-location"]}"
end
当我在节点上运行sudo chef-client 时,出现以下错误:
================================================================================
Recipe Compile Error in /var/chef/cache/cookbooks/install-jasper-license/recipes/default.rb
================================================================================
NoMethodError
-------------
undefined method `[]' for nil:NilClass
在我看来,这个食谱找不到node[:etc][:passwd][tomcat_user]。当 tomcat recipe 运行时,将安装一个 tomcat 用户。我还在这本食谱的 metadata.rb 中添加了depends 'tomcat'。我的意图是在运行 tomcat 的用户的主位置安装一个文件。我该怎么办?
【问题讨论】:
标签: chef-infra cookbook