Class: Kitchen::Transport::Sftp::Connection
- Inherits:
-
Ssh::Connection
- Object
- Ssh::Connection
- Kitchen::Transport::Sftp::Connection
- Defined in:
- lib/kitchen/transport/sftp.rb
Instance Method Summary collapse
-
#close ⇒ Object
Wrap Ssh::Connection#close to also shut down the SFTP connection.
- #upload(locals, remote) ⇒ Object
Instance Method Details
#close ⇒ Object
Wrap Ssh::Connection#close to also shut down the SFTP connection.
50 51 52 53 54 55 56 57 58 |
# File 'lib/kitchen/transport/sftp.rb', line 50 def close if @sftp_session logger.debug("[SFTP] closing connection to #{self}") sftp_session.close_channel end ensure @sftp_session = nil super end |
#upload(locals, remote) ⇒ Object
60 61 62 63 64 65 66 67 68 69 |
# File 'lib/kitchen/transport/sftp.rb', line 60 def upload(locals, remote) Array(locals).each do |local| full_remote = File.join(remote, File.basename(local)) recursive = File.directory?(local) time = Benchmark.realtime do sftp_upload!(local, full_remote, recursive) end logger.info("[SFTP] Time taken to upload #{local} to #{self}:#{full_remote}: %.2f sec" % time) end end |