- From: <
>
- To:
- Subject: [chef] Is "notifies" clause supported in LWRP?
- Date: Wed, 20 Mar 2013 05:31:36 -0700 (PDT)
I observed that in case of LWRP, "notifies" clause don't work as expected
(i.e.
it doesn't notify other resource with given action). Please let me know if
there are any mistakes in the code.
I declared LWRP as -
resources/execute.rb
-----------------------------------
actions :execute
attribute :name, :kind_of => String, :name_attribute => true
attribute :command, :kind_of => String
providers/remote.rb
-----------------------------------
action :execute do
execute "remote_exe_#{new_resource.command}" do
command "#{new_resource.command}"
end
end
recipes/default.rb
------------------------------------------
Remote_execute "lwrp_uninst" do <<<< cookbook name => Remote
command "sudo rpm -e libyaml-0.1.4-1ll.el6.rf.x86_64"
action :nothing
provider "Remote_remote" <<<< cookbook name =>
Remote
end
Remote_execute "lwrp_inst" do <<<< cookbook name =>
Remote
command "sudo rpm -ivh
/home/aditya/Downloads/libyaml-0.1.4-1.el6.rf.x86_64.rpm"
action :execute
provider "Remote_remote" <<<< cookbook name =>
Remote
notifies :execute, "Remote_execute[lwrp_uninst]", :immediately
end
===============================================================
If I try same thing with existing resource e.g. "execute", it works as
expected.
execute "uninstall" do
command "sudo rpm -e libyaml-0.1.4-1.el6.rf.x86_64"
action :nothing
end
execute "install" do
command "sudo rpm -ivh
/home/aditya/Downloads/libyaml-0.1.4-1.el6.rf.x86_64.rpm"
notifies :run, "execute[uninstall]", :immediately
end
Thanks,
Aditya Nitsure
- [chef] Is "notifies" clause supported in LWRP?, adityanitsure, 03/20/2013
Archive powered by MHonArc 2.6.16.