- From: "Julian C. Dunn" <
>
- To: "
" <
>
- Subject: [chef] Re: Need to pass argument from recipe to another in cookbook
- Date: Mon, 22 Sep 2014 23:49:47 -0400
On Mon, Sep 22, 2014 at 5:56 AM,
<
>
wrote:
>
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?
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
<
>
* 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.