ookbook_file "/local_app/#{node[:tcat][:war_name]}.properties" do
source "#{node[:tcat][:war_name]}.properties"
mode 0777
owner "deploy"
group "deploy"
end
Chef::Log.info " host name is #{node['hostname']} "
host=node['hostname']
puts " hostname is #{host}"
output=Array.new
output1=`cat /local_app//#{node[:tcat][:war_name]}.properties | grep -i "#{host}" | cut -d":" -f2 `
#output1.chomp
#output1.delete("\n")
#output1.rstrip()
output1.gsub!(/(\n*)$/, '')
output=output1.split","
node.set[:acc_deploy]=output
#Chef::Log.info "Found correct value #{output1}, &&&& #{output} "
Chef::Log.info "Found correct value again #{node['acc_deploy']} "
node[:acc_deploy].each do |data|
data.chomp
Chef::Log.info "Found correct value wow #{data} "
directory "/local_app/test/#{data}" do
owner "deploy"
group "deploy"
mode 0755
action :create
notifies :run, "bash[inst_tcat_#{data}]", :immediately
end
bash "inst_tcat_#{data}" do
code <<-EOS
set -e -x
pwd
touch /local_app/test/#{data}/abc.txt
EOS
action :nothing
Chef::Log.info "Found correct value in the loop now #{data}"
end
end
Here is the client logs .... as you see in the log it changed the file content but still processed the old file data that was acc1,acc2,acc3