On Friday, March 29, 2013 at 2:20 PM, David Montgomery wrote:
HiIn a ruby block I am trying to load a json object and passing the hash to a template. The json file exists. How to I load a json object do I cna pass to a
node[:neoservers] should look lie this [xxx.xxx.xxx.xxx,yyy.yyy.yyy.yyy]
ruby_block "stuff" do
block do
contents = File.read('/tmp/cluster_ipaddress')
existing_nodes = JSON.parse(contents)
require 'set'
neoservers = [node[:ipaddress]] + existing_nodes
neoservers = neoservers.to_set.to_a.sort
node.default["neoservers"]=neoservers
end
action :run
end
template "/home/ubuntu/neo4j/conf/neo4j.properties" do
path "/home/ubuntu/neo4j/conf/neo4j.properties"
source "neo4j.properties.erb"
owner "root"
group "root"
mode "0644"
variables({
:server_id => server_id, :neoservers => node[:neoservers]
})
#notifies :restart, "service[neo4j]"
#action :nothing
end
Archive powered by MHonArc 2.6.16.