Difference node.recipe? / node.recipes[].include?



I’m a ruby newbie, so please forgive me, if my question is caused by just not knowing the language I use. But I’m not that confident :wink:

node.recipe?(“recipe-name”) should return, whether a recipe is … what?

  • included in the run list?
  • included in the expanded run list?
  • already seen in the current chef run?

It’s e.g. used in the chef-client::config recipe [1] to determine, whether it runs on a chef-server. However, it didn’t work for me, as chef-client recipe is prior to chef-server in the run list.

Using node[“recipes”].include? worked for me. So is this the expanded run list and would node.run_state[:seen_recipes].has_key? equivalent to node.recipe?

If so, should I open a pull request for the chef-client recipe?


[1] https://github.com/opscode-cookbooks/chef-client/blob/master/recipes/config.rb#L40