Method: Chef::Node#expand!

Defined in:
lib/chef/node.rb

#expand!(data_source = 'server') ⇒ Object

Expands the node’s run list and sets the default and override attributes. Also applies stored attributes (from json provided on the command line)

Returns the fully-expanded list of recipes, a RunListExpansion.

– TODO: timh/cw, 5-14-2010: Should this method exist? Should we instead modify default_attrs and override_attrs whenever our run_list is mutated? Or perhaps do something smarter like on-demand generation of default_attrs and override_attrs, invalidated only when run_list is mutated?



325
326
327
328
329
330
331
332
333
334
335
336
337
# File 'lib/chef/node.rb', line 325

def expand!(data_source = 'server')
  expansion = run_list.expand(chef_environment, data_source)
  raise Chef::Exceptions::MissingRole, expansion if expansion.errors?

  self.tags # make sure they're defined

  automatic_attrs[:recipes] = expansion.recipes
  automatic_attrs[:roles] = expansion.roles

  apply_expansion_attributes(expansion)

  expansion
end