Method: Chef::Node#consume_run_list

Defined in:
lib/chef/node.rb

#consume_run_list(attrs) ⇒ Object

Extracts the run list from attrs and applies it. Returns the remaining attributes



294
295
296
297
298
299
300
301
302
303
304
# File 'lib/chef/node.rb', line 294

def consume_run_list(attrs)
  attrs = attrs ? attrs.dup : {}
  if new_run_list = attrs.delete("recipes") || attrs.delete("run_list")
    if attrs.key?("recipes") || attrs.key?("run_list")
      raise Chef::Exceptions::AmbiguousRunlistSpecification, "please set the node's run list using the 'run_list' attribute only."
    end
    Chef::Log.info("Setting the run_list to #{new_run_list.inspect} from JSON")
    run_list(new_run_list)
  end
  attrs
end