Class: Chef::Provisioning::Transport::SSH::SSHResult

Inherits:
Object
  • Object
show all
Defined in:
lib/chef/provisioning/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


245
246
247
248
249
250
251
# File 'lib/chef/provisioning/transport/ssh.rb', line 245

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


253
254
255
# File 'lib/chef/provisioning/transport/ssh.rb', line 253

def command
  @command
end

#exitstatusObject (readonly)

Returns the value of attribute exitstatus


257
258
259
# File 'lib/chef/provisioning/transport/ssh.rb', line 257

def exitstatus
  @exitstatus
end

#optionsObject (readonly)

Returns the value of attribute options


254
255
256
# File 'lib/chef/provisioning/transport/ssh.rb', line 254

def options
  @options
end

#stderrObject (readonly)

Returns the value of attribute stderr


256
257
258
# File 'lib/chef/provisioning/transport/ssh.rb', line 256

def stderr
  @stderr
end

#stdoutObject (readonly)

Returns the value of attribute stdout


255
256
257
# File 'lib/chef/provisioning/transport/ssh.rb', line 255

def stdout
  @stdout
end

Instance Method Details

#error!Object


259
260
261
262
263
264
265
# File 'lib/chef/provisioning/transport/ssh.rb', line 259

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