- From: Dreamcat4 <
>
- To:
- Subject: [chef] Re: Re: Re: Re: Re: Running resources & not_if { } qualifier
- Date: Thu, 2 Dec 2010 17:12:01 +0000
- 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=mV0HO86URataF6y9ceuSb2YrSbOyu5HzyB/J/CXdBJFu1KO7p2l9zwb3owoeV240i2 ls26gXELYYcbUXlwb5lf164AycibYv5dCpMjYvaF3O0+0CZU05vkbxDqmoRSaBjKpSxL mc4WxDULz8zcaabvhzIUtIxowZhpnKgQzm/PQ=
On Thu, Dec 2, 2010 at 4:45 PM, Daniel DeLeo
<
>
wrote:
>
Ohai!
>
>
On Thu, Dec 2, 2010 at 7:56 AM, Ash Berlin
>
<
>
>
wrote:
>
> On 2 Dec 2010, at 15:53, Dreamcat4 wrote:
>
>> On Thu, Dec 2, 2010 at 3:20 PM, Ash Berlin
>
>> <
>
>
>> wrote:
>
>>
>
>> I also wonder if this is a bug in chef? Each time the array of actions
>
>> is wiped out and overwritten. Isn't Chef meant to be smart enough to
>
>> keep the existing actions when encountering new actions?
>
>>
>
It's a feature. The most common use for this is when you have some
>
template where several recipes will need to add some content. Then you
>
do something like this:
>
>
# Recipe A
>
template "/etc/something" do
>
variables(Hash.new) if variables.nil?
>
variables[:foo] = "bar"
>
end
>
>
# Recipe B
>
template "/etc/something" do
>
variables(Hash.new) if variables.nil?
>
variables[:baz] = "qux"
>
end
>
>
It's definitely surprising when you first encounter it, though.
>
>
>>
>
>> dreamcat4
>
>>
>
>
>
> I think its that its not creating a new resource but augmenting the
>
> existing one, so the second block is just changing the action for the
>
> first one (and keeping the not_if) since they are both "rvm default_ruby"
>
> resources.
>
>
>
Exactly.
>
>
> -ash
>
>
Dan DeLeo
>
I too would be surprised to be the first person to notice this. Does
this mean I should be changing my resource somehow? Ie to be creating
a new resource in each instance?
Thanks
dreamcat4
Archive powered by MHonArc 2.6.16.