- From: DV <
>
- To:
- Subject: [chef] Re: Overriding attributes
- Date: Tue, 18 Mar 2014 11:55:25 -0700
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
<
>
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
>
>
https://gist.github.com/rurounijones/5883385
>
>
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.
- [chef] Re: Overriding attributes, DV, 03/18/2014
Archive powered by MHonArc 2.6.16.