Method: Chef::Node#recipe?

Defined in:
lib/chef/node.rb

#recipe?(recipe_name) ⇒ Boolean

Returns true if this Node expects a given recipe, false if not.

First, the run list is consulted to see whether the recipe is explicitly included. If it’s not there, it looks in node[:recipes], which is populated when the run_list is expanded

NOTE: It’s used by cookbook authors

Returns:

  • (Boolean)


279
280
281
# File 'lib/chef/node.rb', line 279

def recipe?(recipe_name)
  run_list.include?(recipe_name) || Array(self[:recipes]).include?(recipe_name)
end