Class: ChefMetalDocker::DockerTransport::DockerResult

Inherits:
Object
  • Object
show all
Defined in:
lib/chef_metal_docker/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.



254
255
256
257
258
259
260
# File 'lib/chef_metal_docker/docker_transport.rb', line 254

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.



262
263
264
# File 'lib/chef_metal_docker/docker_transport.rb', line 262

def command
  @command
end

#exitstatusObject (readonly)

Returns the value of attribute exitstatus.



266
267
268
# File 'lib/chef_metal_docker/docker_transport.rb', line 266

def exitstatus
  @exitstatus
end

#optionsObject (readonly)

Returns the value of attribute options.



263
264
265
# File 'lib/chef_metal_docker/docker_transport.rb', line 263

def options
  @options
end

#stderrObject (readonly)

Returns the value of attribute stderr.



265
266
267
# File 'lib/chef_metal_docker/docker_transport.rb', line 265

def stderr
  @stderr
end

#stdoutObject (readonly)

Returns the value of attribute stdout.



264
265
266
# File 'lib/chef_metal_docker/docker_transport.rb', line 264

def stdout
  @stdout
end

Instance Method Details

#error!Object



268
269
270
271
272
273
274
275
# File 'lib/chef_metal_docker/docker_transport.rb', line 268

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