Hi there,
I try to do a only once command within a chef recipe which looks like the following:
execute "register_spacewalk" do
notifies :create, "ruby_block[register_spacewalk_run_flag]", :immediately
not_if { node.attribute?("register_spacewalk_run_flag")
}
end
ruby_block "register_spacewalk_run_flag" do
block do
node.set["register_spacewalk_run_flag"] = true
node.save
end
action :nothing
End
The 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" do
notifies :create, "ruby_block[register_spacewalk_run_flag]", :immediately
not_if { node.attribute?("spacewalk""register_spacewalk_run_flag")
}
end
ruby_block "register_spacewalk_run_flag" do
block do
node.set["spacewalk"]["register_spacewalk_run_flag"] = true
node.save
end
action :nothing
End
The 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
ruby evaluate from left to right, it will stop at first false found.