[chef] Re: Re: Re: Re: Missing Notification from LWRP


Chronological Thread 
  • From: Andiabes < >
  • To: " " < >
  • Cc: " " < >
  • Subject: [chef] Re: Re: Re: Re: Missing Notification from LWRP
  • Date: Sat, 11 Feb 2012 11:24:38 -0500

+1 


On Feb 11, 2012, at 11:22 AM, Max Gorbul < "> > wrote:

As far as I understand correctly you did not mark you resource as updated. You have to do that in order to enforce notification to be sent

@new_resource.updated_by_last_action(true)

--max

On Sat, Feb 11, 2012 at 8:13 AM, Kevin Christen < "> > wrote:
Jake,

Thanks for the quick response, but unless I misunderstand the ticket, that's not my problem. I changed my recipe to use the old-style notification syntax:

ruby_block "the_observer" do
  block do
    Chef::Log.info("the observer has been notified")
  end
  action :nothing
end

package "my_package" do
  provider :test_my_package
  action :install
  notifies :create, resources(:ruby_block => "the_observer")
end

and the results are the same: no notification is sent to "the_observer". Other ideas?

Thanks,
Kevin Christen


On Sat, Feb 11, 2012 at 9:31 AM, Jake Vanderdray < " target="_blank"> > wrote:
Kevin,

  I suspect you're hitting this bug:
http://tickets.opscode.com/browse/CHEF-2404.

Jake.

On Sat, Feb 11, 2012 at 10:09 AM, Kevin Christen
< " target="_blank"> > wrote:
> Chef 0.10.8. I have an LWRP for the package resource that doesn't send
> notifications. I have a very simple test case that demonstrates the problem.
> Here is the LWRP, from file cookbooks/test/providers/my_package.rb:
>
> action :install do
>   Chef::Log.info("installing #{new_resource.name}")
> end
>
> Here is my recipe:
>
> package "the_package" do
>   provider :test_my_package
>   notifies :create, "ruby_block[the_observer]"
> end
>
> ruby_block "the_observer" do
>   block do
>     Chef::Log.info("the observer has been notified")
>   end
>   action :nothing
> end
>
> Here is the result:
>
> ...
> [Sat, 11 Feb 2012 09:02:04 -0600] INFO: Processing package[the_package]
> action install (test::the_package line 1)
> [Sat, 11 Feb 2012 09:02:04 -0600] INFO: installing the_package
> [Sat, 11 Feb 2012 09:02:04 -0600] INFO: Processing ruby_block[the_observer]
> action nothing (test::the_package line 6)
> [Sat, 11 Feb 2012 09:02:04 -0600] INFO: Chef Run complete in 0.006884
> seconds
> [Sat, 11 Feb 2012 09:02:04 -0600] INFO: Running report handlers
> [Sat, 11 Feb 2012 09:02:04 -0600] INFO: Report handlers complete
>
> I expect the install action of the package to send a create notification to
> the ruby block, which would print "the observer has been notified". I have
> tried a number of variations of this test case:
>
> using subscribes instead of notifies (fails)
> adding supports :create => true on the ruby block (fails)
> using a built in provider instead of an LWRP (succeeds)
>
> What am I missing?
>
> Thanks,
> Kevin Christen





Archive powered by MHonArc 2.6.16.

§