【发布时间】:2015-04-20 13:31:01
【问题描述】:
我正在尝试在配方中动态增加值并在另一个资源中使用,但仍然没有这样做。
Chef::Log.info("I am in #{cookbook_name}::#{recipe_name} and current disk count #{node[:oracle][:asm][:test]}")
bash "beforeTest" do
code lazy{ echo #{node[:oracle][:asm][:test]} }
end
ruby_block "test current disk count" do
block do
node.set[:oracle][:asm][:test] = "#{node[:oracle][:asm][:test]}".to_i+1
end
end
bash "test" do
code lazy{ echo #{node[:oracle][:asm][:test]} }
end
但是我仍然收到以下错误:
NoMethodError ------------- undefined method echo' for Chef::Resource::Bash
Cookbook Trace: ---------------
/var/chef/cache/cookbooks/Oracle11G/recipes/testSplit.rb:3:in block (2 levels) in from_file'
Resource Declaration: ---------------------
# In /var/chef/cache/cookbooks/Oracle11G/recipes/testSplit.rb
1: bash "beforeTest" do
2: code lazy{
3: echo "#{node[:oracle][:asm][:test]}"
4: }
5: end
请您帮忙在 bash 中应该如何使用惰性?如果不懒,还有其他选择吗?
【问题讨论】:
-
上周我不是为你回答了这个问题吗?
-
抱歉打错了..无法删除问题..
标签: ruby chef-infra lazy-evaluation recipe