Class: ChefMetal::Transport::WinRM::WinRMResult
- Inherits:
-
Object
- Object
- ChefMetal::Transport::WinRM::WinRMResult
- Defined in:
- lib/chef_metal/transport/winrm.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#exitstatus ⇒ Object
readonly
Returns the value of attribute exitstatus.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#stderr ⇒ Object
readonly
Returns the value of attribute stderr.
-
#stdout ⇒ Object
readonly
Returns the value of attribute stdout.
Instance Method Summary collapse
- #error! ⇒ Object
-
#initialize(command, options, config, output) ⇒ WinRMResult
constructor
A new instance of WinRMResult.
Constructor Details
#initialize(command, options, config, output) ⇒ WinRMResult
Returns a new instance of WinRMResult.
103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/chef_metal/transport/winrm.rb', line 103 def initialize(command, , config, output) @command = command @options = @config = config @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
#command ⇒ Object (readonly)
Returns the value of attribute command.
119 120 121 |
# File 'lib/chef_metal/transport/winrm.rb', line 119 def command @command end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
121 122 123 |
# File 'lib/chef_metal/transport/winrm.rb', line 121 def config @config end |
#exitstatus ⇒ Object (readonly)
Returns the value of attribute exitstatus.
118 119 120 |
# File 'lib/chef_metal/transport/winrm.rb', line 118 def exitstatus @exitstatus end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
120 121 122 |
# File 'lib/chef_metal/transport/winrm.rb', line 120 def @options end |
#stderr ⇒ Object (readonly)
Returns the value of attribute stderr.
117 118 119 |
# File 'lib/chef_metal/transport/winrm.rb', line 117 def stderr @stderr end |
#stdout ⇒ Object (readonly)
Returns the value of attribute stdout.
116 117 118 |
# File 'lib/chef_metal/transport/winrm.rb', line 116 def stdout @stdout end |
Instance Method Details
#error! ⇒ Object
123 124 125 126 127 128 129 130 |
# File 'lib/chef_metal/transport/winrm.rb', line 123 def error! if exitstatus != 0 msg = "Error: command '#{command}' exited with code #{exitstatus}.\n" msg << "STDOUT: #{stdout}" if ![:stream] && ![:stream_stdout] && config[:log_level] != :debug msg << "STDERR: #{stderr}" if ![:stream] && ![:stream_stderr] && config[:log_level] != :debug raise msg end end |