def build_node
Chef::Log.debug("Building node object for #{node_name}")
if Chef::Config[:solo]
@node = Chef::Node.build(node_name)
else
@node = Chef::Node.find_or_create(node_name)
end
if Chef::Config[:environment] && !Chef::Config[:environment].chop.empty?
@node.chef_environment(Chef::Config[:environment])
end
@node.reset_defaults_and_overrides
@node.consume_external_attrs(ohai.data, @json_attribs)
if Chef::Config[:solo]
@run_list_expansion = @node.expand!('disk')
else
@run_list_expansion = @node.expand!('server')
end
@expanded_run_list_with_versions = @run_list_expansion.recipes.with_version_constraints_strings
Chef::Log.info("Run List is [#{@node.run_list}]")
Chef::Log.info("Run List expands to [#{@expanded_run_list_with_versions.join(', ')}]")
@run_status = Chef::RunStatus.new(@node)
@node
end