Notifications order and grouping


#1

Hi list!

Can I be sure that resources notified by delayed notifications are executed in the same order as they were notified? Or is this non-deterministic?

And is it possible to group resource and notify them at once? e.g. I want to execute some scripts but don’t want to list every single one of them at many places. So can I just notify one resource, which then includes a bunch of resources to execute?

Thanks for your help
Steffen


#2

On Saturday, January 21, 2012 at 2:41 AM, Steffen Gebert wrote:

Hi list!

Can I be sure that resources notified by delayed notifications are executed in the same order as they were notified? Or is this non-deterministic?
Delayed notifications are queued in the order received. One possible gotcha here is that duplicate notifications are quashed, so if you send notifications A, B, C, A, you end up with just A, B, C, and the last one is ignored.

And is it possible to group resource and notify them at once? e.g. I want to execute some scripts but don’t want to list every single one of them at many places. So can I just notify one resource, which then includes a bunch of resources to execute?
Depending on your constraints, you may be best off creating an LWRP for your group of resources and notifying it.

Thanks for your help
Steffen


Dan DeLeo


#3

Thanks for your response, Daniel!

Depending on your constraints, you may be best off creating an LWRP for your group of resources and notifying it.

How can I notify that LWRP?

Created it like this in providers/apply_config.rb:

action :run do
execute “SetPermissions” do

end

Rebuild ZZZAAuto.pm

execute “RebuildConfig” do

end
end

But how to notify it? My only guess was

notifies :run, “providers[apply_config]”

which, of course, does not work.

Thanks in advance
Steffen

On 21.01.2012, at 20:07, Daniel DeLeo wrote:

On Saturday, January 21, 2012 at 2:41 AM, Steffen Gebert wrote:

Hi list!

Can I be sure that resources notified by delayed notifications are executed in the same order as they were notified? Or is this non-deterministic?
Delayed notifications are queued in the order received. One possible gotcha here is that duplicate notifications are quashed, so if you send notifications A, B, C, A, you end up with just A, B, C, and the last one is ignored.

And is it possible to group resource and notify them at once? e.g. I want to execute some scripts but don’t want to list every single one of them at many places. So can I just notify one resource, which then includes a bunch of resources to execute?
Depending on your constraints, you may be best off creating an LWRP for your group of resources and notifying it.

Thanks for your help
Steffen


Dan DeLeo


#4

On Sunday, January 22, 2012 at 9:14 AM, Steffen Gebert wrote:

Thanks for your response, Daniel!

Depending on your constraints, you may be best off creating an LWRP for your group of resources and notifying it.

How can I notify that LWRP?

Created it like this in providers/apply_config.rb:

action :run do
execute “SetPermissions” do

end

Rebuild ZZZAAuto.pm

execute “RebuildConfig” do

end
end

Resources and providers always come in pairs. In the recipe DSL, you create resources which represent a desired state of the system, while the provider does the work of ensuring the system is in the state the resource specified. So you need a resource to go with your provider, then stick it in your recipe the same as you would a built-in resource.

See also: http://wiki.opscode.com/display/chef/Lightweight+Resources+and+Providers+(LWRP)

But how to notify it? My only guess was

notifies :run, “providers[apply_config]”

which, of course, does not work.

Thanks in advance
Steffen

On 21.01.2012, at 20:07, Daniel DeLeo wrote:

On Saturday, January 21, 2012 at 2:41 AM, Steffen Gebert wrote:

Hi list!

Can I be sure that resources notified by delayed notifications are executed in the same order as they were notified? Or is this non-deterministic?
Delayed notifications are queued in the order received. One possible gotcha here is that duplicate notifications are quashed, so if you send notifications A, B, C, A, you end up with just A, B, C, and the last one is ignored.

And is it possible to group resource and notify them at once? e.g. I want to execute some scripts but don’t want to list every single one of them at many places. So can I just notify one resource, which then includes a bunch of resources to execute?
Depending on your constraints, you may be best off creating an LWRP for your group of resources and notifying it.

Thanks for your help
Steffen

HTH,


Dan DeLeo