[chef] Re: How do I test an attribute value in an "only_if" test?


Chronological Thread 
  • From: Ranjib Dey < >
  • To:
  • Subject: [chef] Re: How do I test an attribute value in an "only_if" test?
  • Date: Fri, 24 Jun 2011 15:26:03 +0530

only_if node[:your_attribute] == "ur_overridden_value"
 
On Fri, Jun 24, 2011 at 2:34 PM, 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.

§