- From: Avleen Vig <
>
- To:
- Subject: [chef] Re: Problem with chef recipe run order
- Date: Tue, 22 Feb 2011 16:26:35 -0800
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=ElTixLYHTKcWC5qpUqbYVHTL1dENN0O/Ao84YaXMMG5uq6VfprP9BwS84MtK37yJsW 4xjhqIrRsBYZyQaJYT7BfsVB0n0NYnkt6wzDW1WFvLIUQXBykUSVk476xcf3E54hev8E DPISDY1MdQsHrufPiGHXmjiIg6AKVrRCVUciQ=
(sorry for the top post - short and probably more appropriate)
I think I found the cause here:
http://lists.opscode.com/sympa/arc/chef/2010-02/msg00088.html
The idempotent nature of not_if is causing the problem to appear.
When I looked at the debug output and saw the not_if being applied in
the syslog-ng::prod-web recipe, I assumed the ::default recipe was not
being run until later.
I'm not sure if this is the case or not yet (it shouldn't be, but..).
The not_if statement was being carried forward which resulted in this.
:-)
On Tue, Feb 22, 2011 at 3:48 PM, Avleen Vig
<
>
wrote:
>
This is bizarre - though it may be my lack of understanding of chef :-)
>
Anyone know what might cause this behaviour?
>
>
>
We have a Base role, which looks like this:
>
"run_list": [
>
....
>
"recipe[syslog-ng]",
>
....
>
]
>
>
And a more specific role, OurSite which looks like:
>
"run_list": [
>
"role[Base]",
>
....
>
"recipe[syslog-ng::prod-web]"
>
]
>
>
>
The runlist for the node looks like:
>
"run_list": [ "role[OurSite]" ]
>
>
>
Now, I was expecting that the default "recipe[syslog-ng]" would be
>
getting run quite early on.
>
It has a "not_if" statement on a cookbook_file, which causes it to
>
skip because we later want to use the syslog-ng::prod-web in this
>
specific role.
>
>
*BIZARRE THING*:
>
The syslog-ng isn't run until the syslog-ng::prod-web recipe is supposed to
>
run.
>
I've verified this by moving syslog-ng::prod-web up and down in the
>
run_list and watching the debug output in chef-client.
>
And when the not_if kicks in, in the default recipe, the more specific
>
syslog-ng::prod-web isn't even run.
>
>
Help? I'm *guessing* this is happening because both recipes reference
>
the same cookbook_file, but that doesn't explain why the run for the
>
syslog-ng::default is delayed until much later, and why both recipes
>
aren't run.
>
>
I've included the pertinent bits of the recipes below.
>
>
>
syslog-ng::default:
>
cookbook_file "/etc/syslog-ng/syslog-ng.conf" do
>
not_if "grep 'SPECIAL CONFIG' /etc/syslog-ng/syslog-ng.conf"
>
source "genericv2.conf"
>
owner "root"
>
group "root"
>
mode 00644
>
notifies :restart, resources(:service => "syslog-ng")
>
end
>
>
syslog-ng::prod-web
>
cookbook_file "/etc/syslog-ng/syslog-ng.conf" do
>
backup false
>
source "prodweb-syslog-ng.conf"
>
owner "root"
>
group "root"
>
mode 00644
>
notifies :restart, resources(:service => "syslog-ng")
>
end
>
Archive powered by MHonArc 2.6.16.