# class Shell::ShellSession

### Attributes

client[R]
compile[RW]
node[RW]
node_attributes[R]
recipe[RW]
run_context[RW]

### Public Class Methods

new() click to toggle source

    # File lib/chef/shell/shell_session.rb, line 43
    def initialize
      @node_built = false
      formatter = Chef::Formatters.new(Chef::Config.formatter, STDOUT, STDERR)
      @events = Chef::EventDispatch::Dispatcher.new(formatter)
    end

session_type(type=nil) click to toggle source

    # File lib/chef/shell/shell_session.rb, line 36
    def self.session_type(type=nil)
      @session_type = type if type
      @session_type
    end

### Public Instance Methods

cookbook_loader() click to toggle source

    # File lib/chef/shell/shell_session.rb, line 84
    def cookbook_loader
      nil
    end

definitions() click to toggle source

    # File lib/chef/shell/shell_session.rb, line 80
    def definitions
      nil
    end

node_attributes=(attrs) click to toggle source

    # File lib/chef/shell/shell_session.rb, line 67
    def node_attributes=(attrs)
      @node_attributes = attrs
      @node.consume_attributes(@node_attributes)
    end

node_built?() click to toggle source

    # File lib/chef/shell/shell_session.rb, line 49
    def node_built?
      !!@node_built
    end

rebuild_context() click to toggle source

    # File lib/chef/shell/shell_session.rb, line 92
    def rebuild_context
      raise "Not Implemented! :rebuild_collection should be implemented by subclasses"
    end

reset!() click to toggle source

    # File lib/chef/shell/shell_session.rb, line 53
    def reset!
      loading do
        rebuild_node
        @node = client.node
        shorten_node_inspect
        Shell::Extensions.extend_context_node(@node)
        rebuild_context
        node.consume_attributes(node_attributes) if node_attributes
        @recipe = Chef::Recipe.new(nil, nil, run_context)
        Shell::Extensions.extend_context_recipe(@recipe)
        @node_built = true
      end
    end

resource_collection() click to toggle source

    # File lib/chef/shell/shell_session.rb, line 72
    def resource_collection
      run_context.resource_collection
    end

save_node() click to toggle source

    # File lib/chef/shell/shell_session.rb, line 88
    def save_node
      raise "Not Supported! #{self.class.name} doesn't support #save_node, maybe you need to run chef-shell in client mode?"
    end