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?
From: ganesan15785@gmail.com [ganesan15785@gmail.com]
Sent: Monday, September 22, 2014 4:56 AM
To: chef@lists.opscode.com
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
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?
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?
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?
I don’t understand the complexity in this recipe code. Why a
ruby_block instead of built-in Chef resources? How come you don’t just
do
directory node[‘backup_path’] do
action :create
end
And if you already have node[‘new_directory’] as a node attribute, why
can’t you just consume it from the other recipe?
Julian
–
[ Julian C. Dunn jdunn@aquezada.com * 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 ]