[chef] Re: Re: Re: Attributes not getting set from wrapper cookbook


Chronological Thread 
  • From: "Julian C. Dunn" < >
  • To:
  • Subject: [chef] Re: Re: Re: Attributes not getting set from wrapper cookbook
  • Date: Wed, 11 Dec 2013 12:15:55 -0500

On Wed, Dec 11, 2013 at 3:03 AM, millisami r 
< >
 wrote:
> Thanks for the reply.
> I've modified the case below.
>
> =================================
> app-cookbook
>   - attributes
>     default['asm']['user'] = "vagrant"
>     default['asm']['deploy_to'] = "/home/#{node['asm']['user']}/myapp"
>   - recipes
>     - default.rb
>
>     user node['asm']['user'] do
>       password node['asm']['password']
>       home "/home/#{node['asm']['user']}"
>     end
> ---------------------------------
> app-wrapper-cookbook
>   - recipes
>     - default.rb
>     node.set['asm']['user'] = 'otheruser'
>     include_recipe "app-cookbook::default"
> =================================
>
> In app-cookbook, I've another attribute `['asm']['deploy_to']` which uses
> the `['asm']['user']` to interpolate
> the value to `['asm']['deploy_to']`.
>
> Now running the `app-wrapper-cookbook`, the value for `['asm']['user']` is
> overriden with the value `otheruser`,
> but the value of `['asm']['deploy_to']` still has the `vagrant` in path.
> i.e. It generates `/home/vagrant/myapp` which should also have been
> overridden by `/home/otheruser/myapp`
>
> Is this the way that computed attributes works?
> How chef will resolve such issue?

Because default['asm']['deploy_to'] was computed at attribute load
time, you also need to redefine that in your wrapper. I addressed that
in my blog post as well. :-)

- Julian

-- 
[ Julian C. Dunn 
< >
          * Sorry, I'm    ]
[ WWW: http://www.aquezada.com/staff/julian    * only Web 1.0  ;]
gopher://sdf.org/1/users/keymaker/           * compliant!    ;]
[ PGP: 91B3 7A9D 683C 7C16 715F 442C 6065 D533 FDC2 05B9       ]



Archive powered by MHonArc 2.6.16.

§