[chef] attributes constructed from other attributes aren't added to the attribute map


Chronological Thread 
  • From: Stefán Freyr Stefánsson < >
  • To: " " < >
  • Subject: [chef] attributes constructed from other attributes aren't added to the attribute map
  • Date: Mon, 22 Dec 2014 18:38:07 +0000
  • Accept-language: en-US
  • Authentication-results: spf=none (sender IP is ) ;

Hi.

I just started using test-kitchen again after a bit of a break. I was surprised to find out that a very simple internal cookbook that we've been using now didn't work.

The error occurred when evaluating our default attribute file. It was complaining about an attribute (attr3) that was composed with the value of another attribute (attr2), which in turn was composed from the value of another attribute (attr1). After adding some "raise" lines to the default.rb attribute file in our cookbook and a test recipe we were able to determine that attr1 was added to the map, while attr2 was not added and trying to construct attr3 then resulted in a failure.

Sorry for the convoluted explanation, I make some sad attempt to describe this here: https://gist.github.com/StFS/2a333afe352d0dc8cbb5

As I said I was using test-kitchen for this and in my .kitchen.yml file I had:
  require_chef_omnibus: true

This installed Chef 12.0.3-1 on the vagrant machine (which is a CentOS 7). Since this had been working previously I dug around a bit and noticed that all of our earlier installations seemed to be using version 11 of Chef. So I changed my .kitchen.yml file to specify version 11 of chef and now at least I'm getting further and the attributes map seems to be built correctly in my recipe.

So my question is, is the following syntax for my attribute file in some way wrong? If so, what should I be using? If the syntax is not wrong, is this then a bug in Chef 12? Has it been reported (I didn't find anything during my googling around for this problem)?

Here is an example of an attribute file that would fail:

default['chef_attribute_hell']['attr1'] = "attribute1"
default['chef_attribute_hell']['attr2'] = "#{node.chef_attribute_hell.attr1}/attr2"
default['chef_attribute_hell']['attr3'] = "#{node.chef_attribute_hell.attr2}/attr3"

Kind regards,
Stefan Freyr

p.s. I can make a full blown cookbook with a .kitchen.yml file available which demonstrates this problem if needed.



Archive powered by MHonArc 2.6.16.

§