Le 2014-04-14 13:04, Christian Fröstl a écrit :
Hi there,I try to do a only once command within a chef recipe which looks like the following:execute "register_spacewalk" docommand "rhnreg_ks --serverUrl=http://spw0002.adm.nubon.com/XMLRPC --activationkey=1-d5ecd39c881c8202fd82f7bc930178be --force"notifies :create, "ruby_block[register_spacewalk_run_flag]", :immediatelynot_if { node.attribute?("register_spacewalk_run_flag") }endruby_block "register_spacewalk_run_flag" doblock donode.set["register_spacewalk_run_flag"] = truenode.saveendaction :nothingEndThe above command works fine, but I like to group all my spacewalk attribute variables under the group spacewalk.For this, i tried to do the following:execute "register_spacewalk" docommand "rhnreg_ks --serverUrl=http://spw0002.adm.nubon.com/XMLRPC --activationkey=1-d5ecd39c881c8202fd82f7bc930178be --force"notifies :create, "ruby_block[register_spacewalk_run_flag]", :immediatelynot_if { node.attribute?("spacewalk""register_spacewalk_run_flag") }endruby_block "register_spacewalk_run_flag" doblock donode.set["spacewalk"]["register_spacewalk_run_flag"] = truenode.saveendaction :nothingEndThe node.set command works well, but I cannot do the node.attribute? Method on this attribute. I tried it with many different syntax like („spacewalk:register_spacewalk_run_flag“) or („spacewalk register_spacewalk_run_flag“) or (["spacewalk“]["register_spacewalk_run_flag"]) or ("[spacewalk]“"[register_spacewalk_run_flag]“)Do you have any idea how to solve the problem?Thank you very much.Greetings,Kasimir
Hi,
You should try:
not_if { node.attribute?("spacewalk") && node['spacewalk'].attribute?("register_spacewalk_run_flag") }
ruby evaluate from left to right, it will stop at first false found.
Regards,
Tensibai
Archive powered by MHonArc 2.6.16.