Class: Kitchen::Transport::ExpressSsh::Connection
- Inherits:
-
Ssh::Connection
- Object
- Ssh::Connection
- Kitchen::Transport::ExpressSsh::Connection
- Includes:
- Kitchen::Transport::Express::Archiver
- Defined in:
- lib/kitchen/transport/express_ssh.rb
Instance Method Summary collapse
- #ensure_remote_dir_exists(remote) ⇒ Object
- #upload(locals, remote) ⇒ Object
- #valid_remote_requirements? ⇒ Boolean
Methods included from Kitchen::Transport::Express::Archiver
Instance Method Details
#ensure_remote_dir_exists(remote) ⇒ Object
79 80 81 |
# File 'lib/kitchen/transport/express_ssh.rb', line 79 def ensure_remote_dir_exists(remote) execute("mkdir -p #{remote}") end |
#upload(locals, remote) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/kitchen/transport/express_ssh.rb', line 56 def upload(locals, remote) return super unless valid_remote_requirements? Array(locals).each do |local| if ::File.directory?(local) archive = archive(local) ensure_remote_dir_exists(remote) end logger.debug("[#{LOG_PREFIX}] Uploading #{File.basename(archive || local)} to #{remote}") super(archive || local, remote) extract(File.basename(archive), remote) if archive end end |
#valid_remote_requirements? ⇒ Boolean
70 71 72 73 74 75 76 77 |
# File 'lib/kitchen/transport/express_ssh.rb', line 70 def valid_remote_requirements? execute("(which tar && which gzip) > /dev/null") true rescue => e logger.debug("[#{LOG_PREFIX}] Requirements not met on remote host for Express transport.") logger.debug(e) false end |