mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Add an options hash to scp. Set to {} by default
This commit is contained in:
parent
1066d9eded
commit
2e567a870d
7 changed files with 29 additions and 19 deletions
|
@ -200,12 +200,14 @@ module Fog
|
||||||
Fog::SSH.new(public_ip_address, username, options).run(commands)
|
Fog::SSH.new(public_ip_address, username, options).run(commands)
|
||||||
end
|
end
|
||||||
|
|
||||||
def scp(local_path, remote_path, recursive = false)
|
def scp(local_path, remote_path, options = {})
|
||||||
requires :public_ip_address, :username
|
requires :public_ip_address, :username
|
||||||
|
|
||||||
options = {}
|
upload_options = options.dup
|
||||||
|
#don't want to pass recursive to constructor
|
||||||
|
options.delete(:recursive)
|
||||||
options[:key_data] = [private_key] if private_key
|
options[:key_data] = [private_key] if private_key
|
||||||
Fog::SCP.new(public_ip_address, username, options).upload(local_path, remote_path, recursive)
|
Fog::SCP.new(public_ip_address, username, options).upload(local_path, remote_path, upload_options)
|
||||||
end
|
end
|
||||||
|
|
||||||
def start
|
def start
|
||||||
|
|
|
@ -128,12 +128,14 @@ module Fog
|
||||||
Fog::SSH.new(ips.first['address'], username, options).run(commands)
|
Fog::SSH.new(ips.first['address'], username, options).run(commands)
|
||||||
end
|
end
|
||||||
|
|
||||||
def scp(local_path, remote_path, recursive = false)
|
def scp(local_path, remote_path, options = {})
|
||||||
requires :ips, :username
|
requires :ips, :username
|
||||||
|
|
||||||
options = {}
|
upload_options = options.dup
|
||||||
|
#don't want to pass recursive to constructor
|
||||||
|
options.delete(:recursive)
|
||||||
options[:key_data] = [private_key] if private_key
|
options[:key_data] = [private_key] if private_key
|
||||||
Fog::SCP.new(ips.first['address'], username, options).upload(local_path, remote_path, recursive)
|
Fog::SCP.new(ips.first['address'], username, options).upload(local_path, remote_path, upload_options)
|
||||||
end
|
end
|
||||||
|
|
||||||
def username
|
def username
|
||||||
|
|
|
@ -78,12 +78,14 @@ module Fog
|
||||||
Fog::SSH.new(ip['ip'], username, options).run(commands)
|
Fog::SSH.new(ip['ip'], username, options).run(commands)
|
||||||
end
|
end
|
||||||
|
|
||||||
def scp(local_path, remote_path, recursive = false)
|
def scp(local_path, remote_path, options = {})
|
||||||
requires :ip, :username
|
requires :ip, :username
|
||||||
|
|
||||||
options = {}
|
upload_options = options.dup
|
||||||
|
#don't want to pass recursive to constructor
|
||||||
|
options.delete(:recursive)
|
||||||
options[:key_data] = [private_key] if private_key
|
options[:key_data] = [private_key] if private_key
|
||||||
Fog::SCP.new(ip['ip'], username, options).upload(local_path, remote_path, recursive)
|
Fog::SCP.new(ip['ip'], username, options).upload(local_path, remote_path, upload_options)
|
||||||
end
|
end
|
||||||
|
|
||||||
def setup(credentials = {})
|
def setup(credentials = {})
|
||||||
|
|
|
@ -120,12 +120,14 @@ module Fog
|
||||||
Fog::SSH.new(public_ip_address, username, options).run(commands)
|
Fog::SSH.new(public_ip_address, username, options).run(commands)
|
||||||
end
|
end
|
||||||
|
|
||||||
def scp(local_path, remote_path, recursive = false)
|
def scp(local_path, remote_path, options = {})
|
||||||
requires :public_ip_address, :username
|
requires :public_ip_address, :username
|
||||||
|
|
||||||
options = {}
|
upload_options = options.dup
|
||||||
|
#don't want to pass recursive to constructor
|
||||||
|
options.delete(:recursive)
|
||||||
options[:key_data] = [private_key] if private_key
|
options[:key_data] = [private_key] if private_key
|
||||||
Fog::SCP.new(public_ip_address, username, options).upload(local_path, remote_path, recursive)
|
Fog::SCP.new(public_ip_address, username, options).upload(local_path, remote_path, upload_options)
|
||||||
end
|
end
|
||||||
|
|
||||||
def username
|
def username
|
||||||
|
|
|
@ -110,12 +110,14 @@ module Fog
|
||||||
Fog::SSH.new(addresses.first, username, options).run(commands)
|
Fog::SSH.new(addresses.first, username, options).run(commands)
|
||||||
end
|
end
|
||||||
|
|
||||||
def scp(local_path, remote_path, recursive = false)
|
def scp(local_path, remote_path, options = {})
|
||||||
requires :addresses, :username
|
requires :addresses, :username
|
||||||
|
|
||||||
options = {}
|
upload_options = options.dup
|
||||||
|
#don't want to pass recursive to constructor
|
||||||
|
options.delete(:recursive)
|
||||||
options[:key_data] = [private_key] if private_key
|
options[:key_data] = [private_key] if private_key
|
||||||
Fog::SCP.new(addresses.first, username, options).upload(local_path, remote_path, recursive)
|
Fog::SCP.new(addresses.first, username, options).upload(local_path, remote_path, upload_options)
|
||||||
end
|
end
|
||||||
|
|
||||||
def username
|
def username
|
||||||
|
|
|
@ -151,7 +151,7 @@ module Fog
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def scp(local_path, remote_path, recursive = false)
|
def scp(local_path, remote_path, options = {})
|
||||||
raise 'Not Implemented'
|
raise 'Not Implemented'
|
||||||
# requires :addresses, :username
|
# requires :addresses, :username
|
||||||
#
|
#
|
||||||
|
|
|
@ -23,7 +23,7 @@ module Fog
|
||||||
@options = options
|
@options = options
|
||||||
end
|
end
|
||||||
|
|
||||||
def upload(local_path, remote_path, recursive = false )
|
def upload(local_path, remote_path, options = {} )
|
||||||
Fog::Mock.not_implemented
|
Fog::Mock.not_implemented
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -45,10 +45,10 @@ module Fog
|
||||||
@options = { :paranoid => false }.merge(options)
|
@options = { :paranoid => false }.merge(options)
|
||||||
end
|
end
|
||||||
|
|
||||||
def upload(local_path, remote_path, recursive = false )
|
def upload(local_path, remote_path, options = {} )
|
||||||
begin
|
begin
|
||||||
Net::SCP.start(@address, @username, @options) do |scp|
|
Net::SCP.start(@address, @username, @options) do |scp|
|
||||||
scp.upload!(local_path, remote_path, :recursive => recursive ) do |ch, name, sent, total|
|
scp.upload!(local_path, remote_path, options ) do |ch, name, sent, total|
|
||||||
# TODO: handle progress display?
|
# TODO: handle progress display?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue