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.
-
#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.
79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/chef_metal/transport/winrm.rb', line 79 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.
95 96 97 |
# File 'lib/chef_metal/transport/winrm.rb', line 95 def command @command end |
#exitstatus ⇒ Object (readonly)
Returns the value of attribute exitstatus.
94 95 96 |
# File 'lib/chef_metal/transport/winrm.rb', line 94 def exitstatus @exitstatus end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
96 97 98 |
# File 'lib/chef_metal/transport/winrm.rb', line 96 def @options end |
#stderr ⇒ Object (readonly)
Returns the value of attribute stderr.
93 94 95 |
# File 'lib/chef_metal/transport/winrm.rb', line 93 def stderr @stderr end |
#stdout ⇒ Object (readonly)
Returns the value of attribute stdout.
92 93 94 |
# File 'lib/chef_metal/transport/winrm.rb', line 92 def stdout @stdout end |
Instance Method Details
#error! ⇒ Object
98 99 100 101 102 103 104 105 |
# File 'lib/chef_metal/transport/winrm.rb', line 98 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 |