[chef] RE: Need to pass argument from recipe to another in cookbook


Chronological Thread 
  • From: Martin Smith < >
  • To: " " < >
  • Subject: [chef] RE: Need to pass argument from recipe to another in cookbook
  • Date: Mon, 22 Sep 2014 12:29:02 +0000
  • Accept-language: en-US

Hi there --

Sounds like a good use case for node.run_state:

https://docs.getchef.com/essentials_cookbook_recipes.html#node-run-state

- Martin
________________________________________
From: 

 

Sent: Monday, September 22, 2014 4:56 AM
To: 

Subject: [chef] Need to pass argument from recipe to another in cookbook

Hi,

I had a cookbook with multiple recipes, in one of them having resources like

Path /root/chef-repo/cookbooks/rollback/recipes/default.rb

ruby_block "Create a directry for backup" do
  block do
  FileUtils.mkdir node['backup_path'] unless Dir.exists? node['backup_path']
  $s=FileUtils.mkdir node['new_directory']
  puts "directory#{$s}"
  end
end


I need to pass this global variable $s  to another chef resources in another
recipe like Path /root/chef-repo/cookbooks/rollback/recipes/xxxx.rb, if is is
possible how can i get that value during at run time or in any other way?



Thanks in advance,
Ganesan.A



Archive powered by MHonArc 2.6.16.

§