Class: ChefMetal::Transport::SSH::SSHResult

Inherits:
Object
  • Object
show all
Defined in:
lib/chef_metal/transport/ssh.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command, options, stdout, stderr, exitstatus) ⇒ SSHResult

Returns a new instance of SSHResult.



160
161
162
163
164
165
166
# File 'lib/chef_metal/transport/ssh.rb', line 160

def initialize(command, options, stdout, stderr, exitstatus)
  @command = command
  @options = options
  @stdout = stdout
  @stderr = stderr
  @exitstatus = exitstatus
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



168
169
170
# File 'lib/chef_metal/transport/ssh.rb', line 168

def command
  @command
end

#exitstatusObject (readonly)

Returns the value of attribute exitstatus.



172
173
174
# File 'lib/chef_metal/transport/ssh.rb', line 172

def exitstatus
  @exitstatus
end

#optionsObject (readonly)

Returns the value of attribute options.



169
170
171
# File 'lib/chef_metal/transport/ssh.rb', line 169

def options
  @options
end

#stderrObject (readonly)

Returns the value of attribute stderr.



171
172
173
# File 'lib/chef_metal/transport/ssh.rb', line 171

def stderr
  @stderr
end

#stdoutObject (readonly)

Returns the value of attribute stdout.



170
171
172
# File 'lib/chef_metal/transport/ssh.rb', line 170

def stdout
  @stdout
end

Instance Method Details

#error!Object



174
175
176
177
178
179
180
# File 'lib/chef_metal/transport/ssh.rb', line 174

def error!
  if exitstatus != 0
    # TODO stdout/stderr is already printed at info/debug level.  Let's not print it twice, it's a lot.
    msg = "Error: command '#{command}' exited with code #{exitstatus}.\n"
    raise msg
  end
end