Class: Chef::Provisioning::Transport::WinRM::WinRMResult
- Inherits:
-
Object
- Object
- Chef::Provisioning::Transport::WinRM::WinRMResult
- Defined in:
- lib/chef/provisioning/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.
119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/chef/provisioning/transport/winrm.rb', line 119 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.
135 136 137 |
# File 'lib/chef/provisioning/transport/winrm.rb', line 135 def command @command end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
137 138 139 |
# File 'lib/chef/provisioning/transport/winrm.rb', line 137 def config @config end |
#exitstatus ⇒ Object (readonly)
Returns the value of attribute exitstatus.
134 135 136 |
# File 'lib/chef/provisioning/transport/winrm.rb', line 134 def exitstatus @exitstatus end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
136 137 138 |
# File 'lib/chef/provisioning/transport/winrm.rb', line 136 def @options end |
#stderr ⇒ Object (readonly)
Returns the value of attribute stderr.
133 134 135 |
# File 'lib/chef/provisioning/transport/winrm.rb', line 133 def stderr @stderr end |
#stdout ⇒ Object (readonly)
Returns the value of attribute stdout.
132 133 134 |
# File 'lib/chef/provisioning/transport/winrm.rb', line 132 def stdout @stdout end |
Instance Method Details
#error! ⇒ Object
139 140 141 142 143 144 145 146 |
# File 'lib/chef/provisioning/transport/winrm.rb', line 139 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 |