- From: Sean OMeara <
>
- To:
- Subject: [chef] Re: Is "notifies" clause supported in LWRP?
- Date: Wed, 20 Mar 2013 09:13:26 -0400
Hi.
Just stick "use_inline_resources" at the top of your provider definition.
-s
On Wed, Mar 20, 2013 at 8:31 AM,
<
>
wrote:
>
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
Archive powered by MHonArc 2.6.16.