Ran into this issue today so thought I'd revive this thread.
I'm using postgresql cookbook with chef-solo and cookbook attributes
aren't merged together with attributes set in .json file passed to
chef-solo. Instead .json file attributes override those set in
cookbook.
Here's what's in postgresql/attributes/default.rb:
...
default['postgresql']['pg_hba'] = [
{:type => 'local', :db => 'all', :user => 'postgres', :addr => nil,
:method => 'ident'},
{:type => 'local', :db => 'all', :user => 'all', :addr => nil,
:method => 'ident'},
{:type => 'host', :db => 'all', :user => 'all', :addr =>
'127.0.0.1/32', :method => 'md5'},
{:type => 'host', :db => 'all', :user => 'all', :addr => '::1/128',
:method => 'md5'}
]
...
Here's what in my .json file:
...
{
...
"postgresql": {
...
"pg_hba": [
{ "type": "host", "db": "replication", "user": "postgres",
"addr": "10.0.0.0/8", "method": "trust" }
],
...
"run_list": [ "recipe[postgresql::server]" ]
}
Resulting pg_hba.conf has only one line in it:
host replication postgres 10.0.0.0/8 trust
Since node[:postgresq][:pg_hba] is an array attribute, it should be
merged rather than overwritten.
The behavior is same with chef-solo 10.28.0 and 11.6.0.
I'll go ahead and submit that as a defect unless someone thinks it's
intended behavior.
On Fri, Jun 28, 2013 at 1:55 AM, Jeffrey Jones jjones@toppan-f.co.jp wrote:
Hello all
I have a list of default users I would like for my DB and am attempting to
combine them with ones set in an attribute.json file used by chef solo. The
relevant code is below
attributes.json · GitHub
If there is nothing set in the json file then it write the 3 default values
to pg_hba.conf
However if there are values set in the json then ONLY the values in the
.json file are used. They are not merged in with the default_db_users
despite my setting of them (I tried everything up to force_override which,
as far as I see it, should take precedence),
Am I missing something here?
Cheers
Jeff
--
Best regards, Dmitriy V.