# File lib/chef/client.rb, line 241
    def build_node
      # Allow user to override the environment of a node by specifying
      # a config parameter.
      if Chef::Config[:environment] && !Chef::Config[:environment].chop.empty?
        @node.chef_environment(Chef::Config[:environment])
      end

      # consume_external_attrs may add items to the run_list. Save the
      # expanded run_list, which we will pass to the server later to
      # determine which versions of cookbooks to use.
      @node.reset_defaults_and_overrides
      @node.consume_external_attrs(ohai.data, @json_attribs)

      unless(@override_runlist.empty?)
        @original_runlist = @node.run_list.run_list_items.dup
        runlist_override_sanity_check!
        @node.run_list(*@override_runlist)
        Chef::Log.warn "Run List override has been provided."
        Chef::Log.warn "Original Run List: [#{@original_runlist.join(', ')}]"
        Chef::Log.warn "Overridden Run List: [#{@node.run_list}]"
      end

      @run_list_expansion = expand_run_list

      # @run_list_expansion is a RunListExpansion.
      #
      # Convert @expanded_run_list, which is an
      # Array of Hashes of the form
      #   {:name => NAME, :version_constraint => Chef::VersionConstraint },
      # into @expanded_run_list_with_versions, an
      # Array of Strings of the form
      #   "#{NAME}@#{VERSION}"
      @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, @events)

      @events.node_load_completed(node, @expanded_run_list_with_versions, Chef::Config)

      @node
    end