我已经创建了一个LWRP(我的第一次),但它似乎没有按要求工作。我不知道我是否错过了某些东西或做错了什么。 opscode文件是可怕的。我有下面展示我的代码:厨师轻量级资源提供商不工作
提供商
puts "FOO"
def restart_process
@svc = Chef::Resource::RestartProcesses.new(new_resource.name)
Chef::Log.debug("Restarting services according to the box")
notifies :run, resources(:execute => 'restart-storm')
end
puts "BAR"
action :restart do
execute 'restart-process' do
command <<-EOH
echo "-------Executing restart process--------"
#Some bash code
EOH
end
end
资源
actions :restart
attribute :name, :kind_of => String, :name_attribute => true
def initialize(*args)
super
@action = :restart
end
配方从资源被称为
template "#{install_dir}/####Something" do
source "someSource.erb"
variables(
###Some variables
)
notifies :run, 'nameOfCookbook_nameOfResource[process]'
end
nameOfCookbook_nameOfResource "process" do
action :nothing
end
厨师输出显示FOO BAR但它不打印任何内容我的bash剧本。所以它不运行bash。任何指针?
已编辑。通知:重启,而不是通知:运行应该工作 – PatrickWalker
很酷,这工作。谢谢 :) – noMAD