# class Shell::DoppelGangerClient

### Attributes

node_name[R]

### Public Class Methods

new(node_name) click to toggle source

    # File lib/chef/shell/shell_session.rb, line 230
    def initialize(node_name)
      @node_name = node_name
      @ohai = Ohai::System.new
    end

### Public Instance Methods

build_node() click to toggle source

DoppelGanger implementation of build_node. preserves as many of the node’s attributes, and does not save updates to the server

    # File lib/chef/shell/shell_session.rb, line 243
    def build_node
      Chef::Log.debug("Building node object for #{@node_name}")
      @node = Chef::Node.find_or_create(node_name)
      ohai_data = @ohai.data.merge(@node.automatic_attrs)
      @node.consume_external_attrs(ohai_data,nil)
      @run_list_expansion = @node.expand!('server')
      @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(', ')}]")
      @node
    end

register() click to toggle source

    # File lib/chef/shell/shell_session.rb, line 255
    def register
      @rest = Chef::REST.new(Chef::Config[:chef_server_url], Chef::Config[:node_name], Chef::Config[:client_key])
    end

run_ohai() click to toggle source

Run the very smallest amount of ohai we can get away with and still hope to have things work. Otherwise we’re not very good doppelgangers

    # File lib/chef/shell/shell_session.rb, line 237
    def run_ohai
      @ohai.require_plugin('os')
    end