- From: Matt Ray <
>
- To:
- Subject: [chef] Re: How do I test an attribute value in an "only_if" test?
- Date: Fri, 24 Jun 2011 06:17:23 -0500
You're using assignment '=' instead of equivalence '==' in your
only_if statements.
Thanks,
Matt Ray
Senior Technical Evangelist | Opscode Inc.
| (512) 731-2218
Twitter, IRC, GitHub: mattray
On Fri, Jun 24, 2011 at 4:04 AM, ItsMikeE
<
>
wrote:
>
I have two possible values of a variable, the default attribute and one
>
overridden in a role.
>
In my recipe I would like to test the value of the variable
>
>
Code is of the format
>
>
cookbook_file "/dir/file" do
>
action :create
>
source "default file"
>
owner "root"
>
group "root"
>
mode 0644
>
only_if "test [:filetype]="default""
>
end
>
>
cookbook_file "/dir/file" do
>
action :create
>
source "other file"
>
owner "root"
>
group "root"
>
mode 0644
>
only_if "test [:filetype]="other""
>
end
>
>
The only_if test is not working (syntax error).
>
Is there a way to do this kind of check?
>
Archive powered by MHonArc 2.6.16.