Method: Chef::PolicyBuilder::Dynamic#load_node

Defined in:
lib/chef/policy_builder/dynamic.rb

#load_nodeChef::Node

Loads the node state from the server, then picks the correct implementation class based on the node and json_attribs.

Calls #finish_load_node on the implementation object to complete the loading process. All subsequent lifecycle calls are delegated.

Returns:



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/chef/policy_builder/dynamic.rb', line 66

def load_node
  events.node_load_start(node_name, config)
  Chef::Log.trace("Building node object for #{node_name}")

  @node =
    if Chef::Config[:solo_legacy_mode]
      Chef::Node.build(node_name)
    else
      Chef::Node.find_or_create(node_name)
    end
  select_implementation(node)
  implementation.finish_load_node(node)
  node
  events.node_load_success(node)
rescue Exception => e
  events.node_load_failed(node_name, e, config)
  raise
end