在资源厨师的通知子句中使用属性

using attribute in notify clause of resource chef

我想在资源的通知子句中使用属性值。我写了下面的代码,它首先创建一个目录,然后将 .zip 从 cookbook_file 复制到该目录。它给出了通知子句的错误

notifies :create , 'cookbook_file["#{node['INSTALLDIR']}/#{node['INSTALLER']}"]', :immediately
cookbook_file "#{node['INSTALLDIR']}/#{node['INSTALLER']}" do
    source "installer.zip"
    mode 0755
    owner "no"
    group "admin"
    action :nothing
    notifies :install , 'apt_package[unzip]', :immediately
    notifies :run , 'bash[extract]', :immediately
end

user 'no' do
    comment 'User to run wso2 App Server'
    password 'admin@123'
    home '/home/no'
end

directory node['INSTALLDIR'] do
    owner "no"
    group "admin"
    mode "0755"
    action :create
    notifies :create , 'cookbook_file["#{node['INSTALLDIR']}/#{node['INSTALLER']}"]', :immediately
end

apt_package 'unzip' do
    action :install
end

apt_package 'openjdk-6-jdk' do
    action :install
end

谢谢

问题是字符串插值 (#{...}) 只能在双引号内起作用。试试这个:

notifies :create, "cookbook_file[#{node['INSTALLDIR']}/#{node['INSTALLER']}]", :immediately