Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Cannot Reproduce
-
Affects Version/s: 0.9.14
-
Fix Version/s: None
-
Component/s: Chef Client
-
Labels:None
-
Environment:
Windows 7
Description
I've just spent a long time scratching my head, trying to understand this one. Not sure what I was thinking when I wrote cookbook2:
cookbook1::default -
template "C:/file"
execute "dostuff C:\\file" do
only_if { resources("template[/file]").updated? }
end
cookbook2::default -
require_recipe "cookbook1"
Note that I called 'require_recipe' instead of 'include_recipe'. This was a mistake. The effect of cookbook2 doing this is that cookbook1 is run twice, and any resources protected with an only_if are bypassed. Changing cookbook2 to the following, and cookbook1 worked as expected:
include_recipe "cookbook1::default"
(I'm not sure if adding ::default makes a difference, but it makes the cookbook consistent with all of my other cookbooks)
While I realise that calling the wrong command will have strange effects, given that myself and other deveopers use several scripting lanuages everyday with subtle terminoligy differences, I doubt I am the only one above to have made this mistake. Is is possible to add any protection to stop the above happening if there is no concievable use case?
Issue Links
- relates to
-
CHEF-3285
require_recipe should be deprecated and removed
-
I'm not so sure about this one. This is the definition of require_recipe:
So it's basically an alias. I don't know how to explain the behavior you described, but I'm pretty sure this isn't the cause.