[chef] Re: Re: cookbook file converge does not work on first run ?


Chronological Thread 
  • From: Manoj Thakkar < >
  • To: " " < >
  • Subject: [chef] Re: Re: cookbook file converge does not work on first run ?
  • Date: Sun, 17 Nov 2013 11:43:49 -0800

i am not handline anything for that directory resource, shall i do that ?

this is what y recipe looks like 

cookbook_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/order-rest.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|
base=data.to_s
data.chomp
Chef::Log.info "Found correct value wow  #{data} "
base="install_tcat_" + data

Chef::Log.info "Found correct value wow  #{base} "

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


On Sat, Nov 16, 2013 at 8:30 PM, Julian C. Dunn < " target="_blank"> > wrote:
That looks like the file is updated correctly but the directory is
not. What does your recipe code look like for the "directory"
resource?

- Julian

On Sat, Nov 16, 2013 at 2:44 PM, Manoj Thakkar < "> > wrote:
> Hi,
>
> i have seen t multiple times in my recipe i dont know whats the root cause,
>
> I make a change in the cookbook file , upload the cookbook & then run
> chef-client on the machine.
>
> i see the file changes picked up , but the chef-client run still picks the
> old changes in the file , any idea why ?
>
> Am i missing a setting somewhere ,
>
> Here is an example of what is happening, if you look at he logs below, i
> changed the value from 'acc1','acc2' to acc1,acc2 and it was picked up , but
> even then the chef-client run is creating [/local_app/test/'acc1']  ... what
> is wrong.
>
> Please help and advise.
>
> Thanks
> MAnoj
>
>
> [2013-11-16T11:37:50-08:00] INFO:
> cookbook_file[/local_app/order-rest.properties] created file
> /local_app/order-rest.properties
>
>     - create a new cookbook_file /local_app/order-rest.properties
>         --- /local_app/order-rest.properties    2013-11-16
> 11:32:00.342657412 -0800
>         +++
> /var/chef/cache/cookbooks/base_tomcat/files/default/order-rest.properties
> 2013-11-16 11:37:50.280816205 -0800
>         @@ -1,3 +1,3 @@
>          pbldejksu300:acc1,acc2
>         -pdevecsas300:'acc1','acc2'
>         +pdevecsas300:acc1,acc2
>          ppdsecsas300:acc1,acc2
>
>   * directory[/local_app/test/'acc1'] action
> create[2013-11-16T11:37:50-08:00] INFO: Processing
> directory[/local_app/test/'acc1'] action create (base_tomcat::new1 line 29)
> [2013-11-16T11:37:50-08:00] INFO: directory[/local_app/test/'acc1'] created
> directory /local_app/test/'acc1'



--
[ Julian C. Dunn < "> >          * Sorry, I'm    ]
[ WWW: http://www.aquezada.com/staff/julian    * only Web 1.0  ]
[ gopher://sdf.org/1/users/keymaker/           * compliant!    ]
[ PGP: 91B3 7A9D 683C 7C16 715F 442C 6065 D533 FDC2 05B9       ]




Archive powered by MHonArc 2.6.16.

§