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


Chronological Thread 
  • From: Xabier de Zuazo < >
  • To:
  • Subject: [chef] Re: cookbook file update not picked up by resource
  • Date: Mon, 18 Nov 2013 23:33:17 +0100
  • Organization: Onddo Labs SL


 Hello Manoj,

On Mon, 18 Nov 2013 11:03:48 -0800
Manoj Thakkar 
< >
 wrote:

[...]
> 
> *here is the chef recipe*
> 
> 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//#{node[:tcat][:war_name]}.properties | grep
> -i "#{host}" | cut -d":" -f2 `

 This `cat` command, will be run at compile time and the cookbook_file
 resource above will be run (later) at converge/execution time.

http://docs.opscode.com/essentials_nodes_chef_run.html

 If you want to read the new values you will need to read them at
 converge time, perhaps using the ruby_block resource:

http://docs.opscode.com/resource_ruby_block.html

 You can also run cookbook_file at compile time using #run_action
 method, but this can a be a bit tricky.

https://wiki.opscode.com/display/chef/Evaluate+and+Run+Resources+at+Compile+Time;jsessionid=E91AD9698CE52D7640A2E1C17FB30201

 Regards,

-- 
Xabier de Zuazo Oteiza
IT System Administrator - Onddo Labs S.L.
www.onddo.com
--------------------------------------------------------------------
Public Key = http://www.onddo.com/xabier_zuazo.pub
Key Fingerprint = 8EFA 5B17 7275 5F1F 42B2  26B4 8E18 8B67 9DE1 9468
--------------------------------------------------------------------

Attachment: signature.asc
Description: PGP signature




Archive powered by MHonArc 2.6.16.

§