class Train::Transports::Docker::Connection
Public Class Methods
new(conf)
click to toggle source
Calls superclass method
# File lib/train/transports/docker.rb, line 58 def initialize(conf) super(conf) @id = options[:host] @container = ::Docker::Container.get(@id) || fail("Can't find Docker container #{@id}") @files = {} @cmd_wrapper = nil @cmd_wrapper = CommandWrapper.load(self, @options) self end
Public Instance Methods
close()
click to toggle source
# File lib/train/transports/docker.rb, line 69 def close # nothing to do at the moment end
file(path)
click to toggle source
# File lib/train/transports/docker.rb, line 77 def file(path) @files[path] ||= LinuxFile.new(self, path) end
os()
click to toggle source
# File lib/train/transports/docker.rb, line 73 def os @os ||= OS.new(self) end
run_command(cmd)
click to toggle source
# File lib/train/transports/docker.rb, line 81 def run_command(cmd) cmd = @cmd_wrapper.run(cmd) unless @cmd_wrapper.nil? stdout, stderr, exit_status = @container.exec( [ '/bin/sh', '-c', cmd ]) CommandResult.new(stdout.join, stderr.join, exit_status) rescue ::Docker::Error::DockerError => _ raise rescue => _ # @TODO: differentiate any other error raise end