DonBecker
DonBecker

Reputation: 2454

Can Chef Attributes be referenced from within the same attributes file?

If I have an attribute:

default[:mycookbook][:attr_foo] = "foo"

can I refer to it in the same file, something like this:

default[:mycookbook][:attr_bar] = default[:mycookbook][:attr_foo]

Upvotes: 4

Views: 2965

Answers (1)

DonBecker
DonBecker

Reputation: 2454

This is possible, however the correct sytax is:

default[:mycookbook][:attr_bar] = "#{default[:mycookbook][:attr_foo]}"

..essentially the attribute is wrapped with:

"#{}"

Upvotes: 1

Related Questions