node["apache"] # preferrednode[:apache] # as a symbol, deprecatednode.apache # as a method, deprecated
node["apache"]["dir"]node[:apache][:dir]node.apache.dir
node.attribute?("apache")
node.apache.attribute?("dir")
node["apache"].attribute?("dir")
Thanks for the response
That helps, but still leaves me with some questions
Looking at the wiki page on setting attributes
Default in ../cookbooks/../attributes/default.rb
Example Precedence #1
default["apache"]["dir"] = "/etc/apache2"
Override in .../roles/rolename.rb
Example Precedence #8
override_attributes({ "apache" => {"dir" => "/etc/apache2"}})
How do I reference the attribute inside a recipe?
I don't mind if it is in a case statement, and if statement or an only_if. I am
just trying to choose between one of two source files to overwrite one
destination file.
Again going back to the wiki I can see
if node.chef.attribute?("webui_enabled")
# set up webui stuff
end
How does that equate to the attributes that were set above?
Is it:
if node.apache.dir?
or
if node.chef.attribute?("apache""dir")
or
something else completely?
I don't really mind if it is in an only_if, or a case statement or an if test.
Archive powered by MHonArc 2.6.16.