Class: Fleetctl::RemoteTempfile
- Inherits:
-
Object
- Object
- Fleetctl::RemoteTempfile
- Defined in:
- lib/fleetctl/remote_tempfile.rb
Class Method Summary collapse
Class Method Details
.open(local_file) {|remote_path| ... } ⇒ Object
4 5 6 7 8 9 |
# File 'lib/fleetctl/remote_tempfile.rb', line 4 def open(local_file) remote_path = File.join(Fleetctl..remote_temp_dir, File.basename(local_file.path)) Net::SCP.upload!(Fleetctl..fleet_host, Fleetctl..fleet_user, local_file.path, remote_path, :ssh => Fleetctl..) yield(remote_path) Net::SSH.start(Fleetctl..fleet_host, Fleetctl..fleet_user, Fleetctl..) { |ssh| ssh.exec!("rm #{remote_path}") } end |