Class: Chef::Provisioning::DockerDriver::DockerTransport::DockerResult

Inherits:
Object
  • Object
show all
Defined in:
lib/chef/provisioning/docker_driver/docker_transport.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command, options, stdout, stderr, exitstatus) ⇒ DockerResult

Returns a new instance of DockerResult.



221
222
223
224
225
226
227
# File 'lib/chef/provisioning/docker_driver/docker_transport.rb', line 221

def initialize(command, options, stdout, stderr, exitstatus)
  @command = command
  @options = options
  @stdout = stdout
  @stderr = stderr
  @exitstatus = exitstatus
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



229
230
231
# File 'lib/chef/provisioning/docker_driver/docker_transport.rb', line 229

def command
  @command
end

#exitstatusObject (readonly)

Returns the value of attribute exitstatus.



233
234
235
# File 'lib/chef/provisioning/docker_driver/docker_transport.rb', line 233

def exitstatus
  @exitstatus
end

#optionsObject (readonly)

Returns the value of attribute options.



230
231
232
# File 'lib/chef/provisioning/docker_driver/docker_transport.rb', line 230

def options
  @options
end

#stderrObject (readonly)

Returns the value of attribute stderr.



232
233
234
# File 'lib/chef/provisioning/docker_driver/docker_transport.rb', line 232

def stderr
  @stderr
end

#stdoutObject (readonly)

Returns the value of attribute stdout.



231
232
233
# File 'lib/chef/provisioning/docker_driver/docker_transport.rb', line 231

def stdout
  @stdout
end

Instance Method Details

#error!Object



235
236
237
238
239
240
241
242
# File 'lib/chef/provisioning/docker_driver/docker_transport.rb', line 235

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