[chef] Re: Question on Attribute Merging


Chronological Thread 
  • From: Nick Silkey < >
  • To: " " < >
  • Subject: [chef] Re: Question on Attribute Merging
  • Date: Fri, 16 Jan 2015 02:00:09 +0000

Pardon the mobile brevity, but could you be hitting this as a result of the attribute merge?

https://coderanger.net/arrays-and-chef/

On Thursday, January 15, 2015, David Petzel < "> > wrote:
I'm seeing some interesting with attribute merging, and before I get to deep into the weeds I was wondering what the expected result would be.

We're consuming a community cookbook and we are altering attributes in for that cookbook.
It looks looks something like this:

base_role
{
  level1 => {
    level2 => {
       enabled: true # We want this attribute set to true on ALL nodes
   }
  }
}


app_role
run_list includes base_role
{
  level1 => {
    level2 => {
       proxy_host: 'something'
   }
  }
}

I was expecting these to get merged, and I would end up with this on the app node:
{
  level1 => {
    level2 => {
       enabled: true
       proxy_host: 'something'
   }
  }
}

But in reality all I'm getting is the enabled:true. If I move the proxy_host stuff up to the base it works, and if I move the enabled down to the app_role it also works

I understand I can accomplish what I want with a wrapper cookbook (and that maybe the route I go), but I was curious if I had wrong expectations that the merge should happen, or is this expected when your using two *roles* to accomplish this. 

To be clear I'm not married on this role approach, it just so happens we have roles, and I tried this thinking it might work and when it didn't I started wondering if it should.

Thanks







Archive powered by MHonArc 2.6.16.

§