Class: KnifeSolo::SshConnection::ExecResult

Inherits:
Object
  • Object
show all
Defined in:
lib/knife-solo/ssh_connection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(exit_code = nil) ⇒ ExecResult

Returns a new instance of ExecResult.



8
9
10
11
12
# File 'lib/knife-solo/ssh_connection.rb', line 8

def initialize(exit_code = nil)
  @exit_code = exit_code
  @stdout = ""
  @stderr = ""
end

Instance Attribute Details

#exit_codeObject

Returns the value of attribute exit_code.



6
7
8
# File 'lib/knife-solo/ssh_connection.rb', line 6

def exit_code
  @exit_code
end

#stderrObject

Returns the value of attribute stderr.



6
7
8
# File 'lib/knife-solo/ssh_connection.rb', line 6

def stderr
  @stderr
end

#stdoutObject

Returns the value of attribute stdout.



6
7
8
# File 'lib/knife-solo/ssh_connection.rb', line 6

def stdout
  @stdout
end

Instance Method Details

#stderr_or_stdoutObject

Helper to use when raising exceptions since some operations (e.g., command not found) error on stdout



20
21
22
23
# File 'lib/knife-solo/ssh_connection.rb', line 20

def stderr_or_stdout
  return stderr unless stderr.empty?
  stdout
end

#success?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/knife-solo/ssh_connection.rb', line 14

def success?
  exit_code == 0
end