有多種方式,以檢查廚師嵌套屬性的存在,我不知道這是正確的/最好的,如果有的話會導致空屬性被存儲在節點上:檢查Chef中是否存在嵌套屬性的正確方法是什麼?
node[:parent] and node[:parent][:child]
node.attribute?(:parent) and node[:parent].attribute?(:child))
node[:parent].nil? and node[:parent][:child].nil?
能夠同時檢查父母和孩子是非常受歡迎的,但我不知道這是否可能。我使用的是廚師10,而不是廚師11,儘管解釋的答案是受歡迎的。