Class: ChefMetal::Transport::WinRM::WinRMResult

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ WinRMResult

Returns a new instance of WinRMResult.



71
72
73
74
75
76
77
78
79
# File 'lib/chef_metal/transport/winrm.rb', line 71

def initialize(output)
  @exitstatus = output[:exitcode]
  @stdout = ''
  @stderr = ''
  output[:data].each do |data|
    @stdout << data[:stdout] if data[:stdout]
    @stderr << data[:stderr] if data[:stderr]
  end
end

Instance Attribute Details

#exitstatusObject (readonly)

Returns the value of attribute exitstatus.



83
84
85
# File 'lib/chef_metal/transport/winrm.rb', line 83

def exitstatus
  @exitstatus
end

#stderrObject (readonly)

Returns the value of attribute stderr.



82
83
84
# File 'lib/chef_metal/transport/winrm.rb', line 82

def stderr
  @stderr
end

#stdoutObject (readonly)

Returns the value of attribute stdout.



81
82
83
# File 'lib/chef_metal/transport/winrm.rb', line 81

def stdout
  @stdout
end

Instance Method Details

#error!Object



85
86
87
# File 'lib/chef_metal/transport/winrm.rb', line 85

def error!
  raise "Error: code #{exitstatus}.\nSTDOUT:#{stdout}\nSTDERR:#{stderr}" if exitstatus != 0
end