Class: Kitchen::Transport::Dockercp::Connection
- Inherits:
-
Ssh::Connection
- Object
- Ssh::Connection
- Kitchen::Transport::Dockercp::Connection
- Defined in:
- lib/kitchen/transport/dockercp.rb
Instance Method Summary collapse
-
#initialize(opts) ⇒ Connection
constructor
A new instance of Connection.
- #upload(locals, remote) ⇒ Object
Constructor Details
#initialize(opts) ⇒ Connection
Returns a new instance of Connection.
26 27 28 29 30 |
# File 'lib/kitchen/transport/dockercp.rb', line 26 def initialize(opts) @instance = opts.delete(:instance) @container_name = @instance.driver.send(:config)[:instance_name] super end |
Instance Method Details
#upload(locals, remote) ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/kitchen/transport/dockercp.rb', line 32 def upload(locals, remote) Array(locals).each do |local| full_remote = File.join(remote, File.basename(local)) time = Benchmark.realtime do system("docker cp #{local} #{@container_name}:#{full_remote}") end logger.info("[Docker CP] Time taken to upload #{local} to #{@container_name}:#{full_remote}: %.2f sec" % time) end end |