Class: Chef::Provisioning::Transport::WinRM::WinRMResult

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command, options, config, output) ⇒ WinRMResult

Returns a new instance of WinRMResult.



117
118
119
120
121
122
123
124
# File 'lib/chef/provisioning/transport/winrm.rb', line 117

def initialize(command, options, config, output)
  @command = command
  @options = options
  @config = config
  @exitstatus = output.exitcode
  @stdout = output.stdout
  @stderr = output.stderr
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



129
130
131
# File 'lib/chef/provisioning/transport/winrm.rb', line 129

def command
  @command
end

#configObject (readonly)

Returns the value of attribute config.



131
132
133
# File 'lib/chef/provisioning/transport/winrm.rb', line 131

def config
  @config
end

#exitstatusObject (readonly)

Returns the value of attribute exitstatus.



128
129
130
# File 'lib/chef/provisioning/transport/winrm.rb', line 128

def exitstatus
  @exitstatus
end

#optionsObject (readonly)

Returns the value of attribute options.



130
131
132
# File 'lib/chef/provisioning/transport/winrm.rb', line 130

def options
  @options
end

#stderrObject (readonly)

Returns the value of attribute stderr.



127
128
129
# File 'lib/chef/provisioning/transport/winrm.rb', line 127

def stderr
  @stderr
end

#stdoutObject (readonly)

Returns the value of attribute stdout.



126
127
128
# File 'lib/chef/provisioning/transport/winrm.rb', line 126

def stdout
  @stdout
end

Instance Method Details

#error!Object



133
134
135
136
137
138
139
140
# File 'lib/chef/provisioning/transport/winrm.rb', line 133

def error!
  if exitstatus != 0
    msg = "Error: command '#{command}' exited with code #{exitstatus}.\n"
    msg << "STDOUT: #{stdout}" if !options[:stream] && !options[:stream_stdout] && config[:log_level] != :debug
    msg << "STDERR: #{stderr}" if !options[:stream] && !options[:stream_stderr] && config[:log_level] != :debug
    raise msg
  end
end