[chef] Re: Re: Notifying Resources within Ruby Block Resource


Chronological Thread 
  • From: Allan Wind < >
  • To:
  • Subject: [chef] Re: Re: Notifying Resources within Ruby Block Resource
  • Date: Wed, 23 Nov 2011 16:59:26 -0500

On 2011-11-14 18:44:35, Bryan McLellan wrote:
> # At run time
> ruby_block "foo" do
>   block do
>     resources(:service => "apache2").run_action(:restart)
>   end
> end

Any idea why this does not work for a dynamically defined 
resource?

service = "service[daemon_foo]"

ruby_block 'obligatory_foo' do
        block do
                delete.each do |f|
                        r = Chef::Resource::File.new((plugin_conf_path + 
f).to_s, run_context)
                        r.notifies :reload, service
                        r.run_action :delete
                end
        end
end

service 'daemon_foo' do
        action [ :enable, :start ]
        supports :reload => true
end

The delete works just fine but notification goes to /dev/null, and the daemon
is restarted if the normal compile time resources trigger a reload.


/Allan
-- 
Allan Wind
Life Integrity, LLC
<http://lifeintegrity.com>



Archive powered by MHonArc 2.6.16.

§