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
chefの出力にはFOOBARが表示されますが、 bashスクリプト内には何も出力されません。したがって、bashは実行されません。ポインタはありますか?