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?



485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
# File 'lib/chef/node.rb', line 485

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

  tags # make sure they're defined

  automatic_attrs[:recipes] = expansion.recipes.with_duplicate_names
  automatic_attrs[:expanded_run_list] = expansion.recipes.with_fully_qualified_names_and_version_constraints
  automatic_attrs[:roles] = expansion.roles

  apply_expansion_attributes(expansion)

  automatic_attrs[:chef_environment] = chef_environment
  expansion
end