[chef] Attribute overrides in wrapper cookbook


Chronological Thread 
  • From: Bill Young < >
  • To:
  • Subject: [chef] Attribute overrides in wrapper cookbook
  • Date: Mon, 13 Jan 2014 15:02:03 -0500

Hello All,

I am writing a wrapper cookbook for the community postgresql cookbook. Essentially, what I'm trying to do is override the following attributes:

default['postgresql']['enable_pgdg_apt'] = false
default['postgresql']['version'] = "9.1"

However, many of the attributes within the community postgresql cookbook use string interpolation for the version. Example:

default['postgresql']['server']['packages'] = ["postgresql-#{node['postgresql']['version']}"]

When setting an override attribute in my wrapper cookbook to set the version of PostgreSQL to "9.3" - the attributes within the PostgreSQL cookbook that interpolate the version attribute do not receive the attribute override.

Two notes:

-  I am able to set the postgresql version attribute to the desired "9.3" in my .kitchen.yml file and the override works as you would expect/hope it would. Meaning, all string interpolated attributes in the postgresql cookbook receive "9.3" as its version.

- After going through and overriding all attributes within the PostgreSQL cookbook that use string interpolation, I ran into one last snag that has stopped me from completing the cookbook. There are two attributes within the PostgreSQL cookbook that set the "unix_socket_directory[-ies]" attribute based on the PostgreSQL version. However, since the logic is broken up into two separate lines, and the string interpolation doesn't pick up the correct version, it will actually add both attributes to the postgresql.conf template - breaking the service.

Lines 166-167


I appreciate any input, thanks!


Bill Young





Archive powered by MHonArc 2.6.16.

§