[chef] Question on Attribute Merging


Chronological Thread 
  • From: David Petzel < >
  • To:
  • Subject: [chef] Question on Attribute Merging
  • Date: Thu, 15 Jan 2015 20:28:19 -0500

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.

§