- From: Chad Woolley <
>
- To:
- Subject: [chef] Re: Re: Including Cookbooks Conditionally
- Date: Sun, 23 May 2010 22:04:51 -0700
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=D4GMmtjOjqif3COg7MNQ8/vBWsy/XkmCCNvRWlIjD59b7/HgJj8DwzVKZTJ1SCmaK0 B4DCfB97Q5zRsFXpa3D0ZTxXJel1ACGOPaH6ugBRYAbW0ASdhEii8vFc6Zui0b9NRMfK Yxa02vXRaAPuR3IUlCZXUpVdj0kBSsKD/Z7tc=
On Sun, Apr 25, 2010 at 10:06 AM, Adam Jacob
<
>
wrote:
>
Interesting use case.
>
>
For your wanting to make sure that no services get restarted, you can
>
probably do something like this. Make sure it's the last recipe in
>
the run list:
>
>
collection.each do |r|
>
# Switch every service resource off
>
r.action :nothing if r.resource_name == :service
>
# Find all notified/subscribed actions on services and switch them off too
>
r.actions.each do |action, timings|
>
timings.each do |timing, resources|
>
resources.each do |notified_resource|
>
notified_resource.action :nothing if
>
notified_resource.resource_name == :service
>
end
>
end
>
end
>
end
>
>
That's off the top of my head, so it may not run. But the idea here is:
>
>
If you are running in the chroot, and we don't want any service
>
actions to be taken, we walk the resource collection and set the
>
action for every service resource we encounter to :nothing. The
>
result will be that no service resources are ever run, no matter what
>
changes happen in the cookbooks you add.
>
>
The only caveat is that this must be the *last* recipe in the
>
run-list, or you're not certain to have seen every possible resource
>
in the collection.
>
>
The benefit should be obvious - just include this recipe when you want
>
to do your chroot sauce, and skip the need to do complicated overrides
>
entirely.
This is working somewhat, but delayed actions are still executed. For
example, the mysql server grant:
http://github.com/opscode/cookbooks/blob/master/mysql/recipes/server.rb#L97
How can I disable this as well?
Thanks,
-- Chad
- [chef] Re: Re: Including Cookbooks Conditionally, Chad Woolley, 05/23/2010
Archive powered by MHonArc 2.6.16.