Chef: неопределенный атрибут узла или метод `<< 'на` узле' при попытке добавить
В моем файле атрибутов для рецепта postgresql у меня есть:
default['postgresql']['pg_hba'] = {
:comment => '# IPv4 local connections',
:type => 'host',
:db => 'all',
:user => 'all',
:addr => '127.0.0.1/32',
:method => 'md5'
}
Я хочу, чтобы мой рецепт автоматически добавлял мои серверы в файл конфигурации pg_hga следующим образом:
lambda {
if Chef::Config[:solo]
return (Array.new.push node)
end
search(:node, "recipes:my_server AND chef_environment:#{node.chef_environment} ")
}.call.each do |server_node|
node['postgresql']['pg_hba'] << {
:comment => "# Enabling for #{server_node['ipaddress']}",
:type => 'host',
:db => 'all',
:user => 'all',
:addr => "#{server_node['ipaddress']}/32",
:method => 'trust'
}
end
include_recipe 'postgresql'
Но я получаю сообщение об ошибке:
NoMethodError
-------------
Undefined node attribute or method `<<' on `node'
35: node['postgresql']['pg_hba'] << {
36: :comment => "# Enabling for #{server_node['ipaddress']}",
37: :type => 'host',
38: :db => 'all',
39: :user => 'all',
40: :addr => "#{server_node['ipaddress']}/32",
41: :method => 'trust'
42>> }
43: end
44:
45: include_recipe 'postgresql'