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.



181
182
183
184
185
186
187
# File 'lib/chef_metal/transport/ssh.rb', line 181

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.



189
190
191
# File 'lib/chef_metal/transport/ssh.rb', line 189

def command
  @command
end

#exitstatusObject (readonly)

Returns the value of attribute exitstatus.



193
194
195
# File 'lib/chef_metal/transport/ssh.rb', line 193

def exitstatus
  @exitstatus
end

#optionsObject (readonly)

Returns the value of attribute options.



190
191
192
# File 'lib/chef_metal/transport/ssh.rb', line 190

def options
  @options
end

#stderrObject (readonly)

Returns the value of attribute stderr.



192
193
194
# File 'lib/chef_metal/transport/ssh.rb', line 192

def stderr
  @stderr
end

#stdoutObject (readonly)

Returns the value of attribute stdout.



191
192
193
# File 'lib/chef_metal/transport/ssh.rb', line 191

def stdout
  @stdout
end

Instance Method Details

#error!Object



195
196
197
198
199
200
201
# File 'lib/chef_metal/transport/ssh.rb', line 195

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