[chef] Re: cookbook file update not picked up by resource


Chronological Thread 
  • From: Manoj Thakkar < >
  • To: " " < >
  • Subject: [chef] Re: cookbook file update not picked up by resource
  • Date: Mon, 18 Nov 2013 12:18:20 -0800

can anyone please help me point out the issue here,

I removed the node.set assuming thats the issue and is using a local variable now, but its still the same issue, 

Thanks
Manoj


On Mon, Nov 18, 2013 at 11:03 AM, Manoj Thakkar < " target="_blank"> > wrote:
Hi, 

i am updating a file using cookbook file and then reading the contents of the file ,

The file do get updated ion the client , but when i read the file the file always read the previous content not the updated one,

I am not sure whats wrong here, please advise.

Here is the  properties file i am updating 
pbldejksu300:acc1,acc2
pdevecsas300:acc1,acc4
ppdsecsas300:acc1,acc2

here is the chef recipe 

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



 - create a new cookbook_file /local_app/order-rest.properties
        --- /local_app/order-rest.properties    2013-11-18 10:56:04.408395557 -0800
        +++ /var/chef/cache/cookbooks/base_tomcat/files/default/order-rest.properties   2013-11-18 10:59:03.826165321 -0800
        @@ -1,3 +1,3 @@
         pbldejksu300:acc1,acc2
        -pdevecsas300:acc1,acc2,acc3
        +pdevecsas300:acc1,acc4
         ppdsecsas300:acc1,acc2

  * directory[/local_app/test/acc1] action create[2013-11-18T10:59:03-08:00] INFO: Processing directory[/local_app/test/acc1] action create (base_tomcat::new1 line 26)
 (up to date)
  * bash[inst_tcat_acc1] action nothing[2013-11-18T10:59:03-08:00] INFO: Processing bash[inst_tcat_acc1] action nothing (base_tomcat::new1 line 34)
 (up to date)
  * directory[/local_app/test/acc2] action create[2013-11-18T10:59:03-08:00] INFO: Processing directory[/local_app/test/acc2] action create (base_tomcat::new1 line 26)
 (up to date)
  * bash[inst_tcat_acc2] action nothing[2013-11-18T10:59:03-08:00] INFO: Processing bash[inst_tcat_acc2] action nothing (base_tomcat::new1 line 34)
 (up to date)
  * directory[/local_app/test/acc3] action create[2013-11-18T10:59:03-08:00] INFO: Processing directory[/local_app/test/acc3] action create (base_tomcat::new1 line 26)
[2013-11-18T10:59:03-08:00] INFO: directory[/local_app/test/acc3] created directory /local_app/test/acc3

    - create new directory /local_app/test/acc3[2013-11-18T10:59:03-08:00] INFO: directory[/local_app/test/acc3] owner changed to 101
[2013-11-18T10:59:03-08:00] INFO: directory[/local_app/test/acc3] group changed to 57001
[2013-11-18T10:59:03-08:00] INFO: directory[/local_app/test/acc3] mode changed to 755





Archive powered by MHonArc 2.6.16.

§