1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Add recursive argument to server scp methods. Set to false by default

This commit is contained in:
Luke Robins 2011-06-05 17:11:57 +10:00
parent ceadcb9518
commit 1066d9eded
7 changed files with 14 additions and 14 deletions

View file

@ -200,12 +200,12 @@ module Fog
Fog::SSH.new(public_ip_address, username, options).run(commands)
end
def scp(local_path, remote_path)
def scp(local_path, remote_path, recursive = false)
requires :public_ip_address, :username
options = {}
options[:key_data] = [private_key] if private_key
Fog::SCP.new(public_ip_address, username, options).upload(local_path, remote_path)
Fog::SCP.new(public_ip_address, username, options).upload(local_path, remote_path, recursive)
end
def start

View file

@ -128,12 +128,12 @@ module Fog
Fog::SSH.new(ips.first['address'], username, options).run(commands)
end
def scp(local_path, remote_path)
def scp(local_path, remote_path, recursive = false)
requires :ips, :username
options = {}
options[:key_data] = [private_key] if private_key
Fog::SCP.new(ips.first['address'], username, options).upload(local_path, remote_path)
Fog::SCP.new(ips.first['address'], username, options).upload(local_path, remote_path, recursive)
end
def username

View file

@ -78,12 +78,12 @@ module Fog
Fog::SSH.new(ip['ip'], username, options).run(commands)
end
def scp(local_path, remote_path)
def scp(local_path, remote_path, recursive = false)
requires :ip, :username
options = {}
options[:key_data] = [private_key] if private_key
Fog::SCP.new(ip['ip'], username, options).upload(local_path, remote_path)
Fog::SCP.new(ip['ip'], username, options).upload(local_path, remote_path, recursive)
end
def setup(credentials = {})

View file

@ -120,12 +120,12 @@ module Fog
Fog::SSH.new(public_ip_address, username, options).run(commands)
end
def scp(local_path, remote_path)
def scp(local_path, remote_path, recursive = false)
requires :public_ip_address, :username
options = {}
options[:key_data] = [private_key] if private_key
Fog::SCP.new(public_ip_address, username, options).upload(local_path, remote_path)
Fog::SCP.new(public_ip_address, username, options).upload(local_path, remote_path, recursive)
end
def username

View file

@ -110,12 +110,12 @@ module Fog
Fog::SSH.new(addresses.first, username, options).run(commands)
end
def scp(local_path, remote_path)
def scp(local_path, remote_path, recursive = false)
requires :addresses, :username
options = {}
options[:key_data] = [private_key] if private_key
Fog::SCP.new(addresses.first, username, options).upload(local_path, remote_path)
Fog::SCP.new(addresses.first, username, options).upload(local_path, remote_path, recursive)
end
def username

View file

@ -151,7 +151,7 @@ module Fog
end
end
def scp(local_path, remote_path)
def scp(local_path, remote_path, recursive = false)
raise 'Not Implemented'
# requires :addresses, :username
#

View file

@ -23,7 +23,7 @@ module Fog
@options = options
end
def upload(local_path, remote_path)
def upload(local_path, remote_path, recursive = false )
Fog::Mock.not_implemented
end
@ -45,10 +45,10 @@ module Fog
@options = { :paranoid => false }.merge(options)
end
def upload(local_path, remote_path)
def upload(local_path, remote_path, recursive = false )
begin
Net::SCP.start(@address, @username, @options) do |scp|
scp.upload!(local_path, remote_path) do |ch, name, sent, total|
scp.upload!(local_path, remote_path, :recursive => recursive ) do |ch, name, sent, total|
# TODO: handle progress display?
end
end