[chef] Re: Overriding computed attributes


Chronological Thread 
  • From: Jeff Byrnes < >
  • To:
  • Subject: [chef] Re: Overriding computed attributes
  • Date: Mon, 19 May 2014 13:45:22 -0400

Jeppe:

No, it will not. Because of how the attributes are evaluated, the defaults will be set, then node[:foo][:ver] will be overridden. It’s generally considered best practice, if you’re going to use attributes to compute another attribute, to set the computed attribute in a recipe. Here’s a nice resource for this (and other tidbits): https://wiki.opscode.com/display/chef/Cookbook+Style+Guide+Draft#CookbookStyleGuideDraft-GeneratingData

-- 
Jeff Byrnes
@berkleebassist
Operations Engineer
704.516.4628

On May 19, 2014 at 1:42:32 PM, Jeppe Nejsum Madsen ( "> ) wrote:

Ohai,

Assume we have an attribute file in cookbook A:

default[:foo][:ver] = '1.0'
default[:foo][:url] = "http://....#{node[:foo][:ver]}"

Then in cookbook B:

override[:foo][:ver] = '2.0'

Will node[:foo][:url] be the expected value?

I'm not seeing this, so was wondering if there's a way to achieve it....

/Jeppe






Archive powered by MHonArc 2.6.16.

§