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



276
277
278
279
280
281
282
# File 'lib/chef/provisioning/docker_driver/docker_transport.rb', line 276

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.



284
285
286
# File 'lib/chef/provisioning/docker_driver/docker_transport.rb', line 284

def command
  @command
end

#exitstatusObject (readonly)

Returns the value of attribute exitstatus.



288
289
290
# File 'lib/chef/provisioning/docker_driver/docker_transport.rb', line 288

def exitstatus
  @exitstatus
end

#optionsObject (readonly)

Returns the value of attribute options.



285
286
287
# File 'lib/chef/provisioning/docker_driver/docker_transport.rb', line 285

def options
  @options
end

#stderrObject (readonly)

Returns the value of attribute stderr.



287
288
289
# File 'lib/chef/provisioning/docker_driver/docker_transport.rb', line 287

def stderr
  @stderr
end

#stdoutObject (readonly)

Returns the value of attribute stdout.



286
287
288
# File 'lib/chef/provisioning/docker_driver/docker_transport.rb', line 286

def stdout
  @stdout
end

Instance Method Details

#error!Object



290
291
292
293
294
295
296
297
# File 'lib/chef/provisioning/docker_driver/docker_transport.rb', line 290

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