Chef: Undefined node attribute or method `<<' on `node' when trying to add

醉酒当歌 提交于 2019-12-02 03:22:54

Your problem is here:

node['postgresql']['pg_hba'] << {

This way you're accessing the attribute for reading.

Assuming you want to stay at default level you have to use default method like this:

node.default['postgresql']['pg_hba'] << { ... }

This will call default method (like in attribute file) to add the entry.

For this to work the first attribute declaration should be an array (or a hash of hash) like this:

default['postgresql']['pg_hba'] = [{ # notice the [ opening an array
    :comment => '# IPv4 local connections',
    :type => 'host',
    :db => 'all',
    :user => 'all',
    :addr => '127.0.0.1/32',
    :method => 'md5'
}] # Same here to close the array
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!