Chef Override Attributes in KITCHEN_YAML (default/attributes vs Chef env vs KITCHEN_YAML

14 views Asked by At

So here is my question - providing some context. We have a use case where we have an attribute - holding an array of values defined in Cookbook - attributes/default.rb file. The attribute is overridden in Chef environment file - this was done under override_attributes, this was moved to default_attributes. The move was done because we want to be able to override the value in KITCHEN_YAML.

We use kitchen-oci Ruby GEM to provision the Kitcehn VM. Overrides from the Chef environment (including from the attribute in question) are used in the Chef recipes.

In KITCHEN_YAML file, the override for the attribute is defined under attributes section.

Now, when converging the Kitchen VM, the following is observed.

  • If the Chef environment values are defined under default_attributes then the actual value becomes additive. That is, the attribute has a value that is combination of array items defined in Cookbook attributes/default.rb file and KITCHEN_YAML file.
  • If the Chef environment values are defined under override_attributes then the values in KITCHEN_YAML have no effect.

Is above (from first point) expected? What would be the ideal way to enable overriding the values in KITCHEN_YAML without having to make a copy of the Chef environment and then making adjustment in that.

0

There are 0 answers