mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
add Net::SCP options parameter to Fog::SCP proxy
This commit is contained in:
parent
7402e8b04b
commit
b9198da1f7
8 changed files with 24 additions and 18 deletions
|
@ -39,12 +39,18 @@ Shindo.tests('compute examples', 'compute') do
|
|||
@server.ssh('pwd')
|
||||
end
|
||||
|
||||
# scp to a server
|
||||
# scp a file to a server
|
||||
lorem_path = File.join([File.dirname(__FILE__), '..', 'tests', 'lorem.txt'])
|
||||
tests("@server.scp('#{lorem_path}', 'lorem.txt')").succeeds do
|
||||
@server.scp(lorem_path, 'lorem.txt')
|
||||
end
|
||||
|
||||
# scp a directory to a server
|
||||
lorem_dir = File.join([File.dirname(__FILE__), '..', 'tests'])
|
||||
tests("@server.scp('#{lorem_dir}', '/tmp/lorem', :recursive => true)").succeeds do
|
||||
@server.scp(lorem_dir, '/tmp/lorem', :recursive => true)
|
||||
end
|
||||
|
||||
# destroy the server
|
||||
tests('@server.destroy').succeeds do
|
||||
@server.destroy
|
||||
|
|
|
@ -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, scp_options = nil)
|
||||
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, scp_options)
|
||||
end
|
||||
|
||||
def start
|
||||
|
|
|
@ -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, scp_options = nil)
|
||||
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, scp_options)
|
||||
end
|
||||
|
||||
def username
|
||||
|
|
|
@ -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, scp_options = nil)
|
||||
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, scp_options)
|
||||
end
|
||||
|
||||
def setup(credentials = {})
|
||||
|
|
|
@ -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, scp_options = nil)
|
||||
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, scp_options)
|
||||
end
|
||||
|
||||
def username
|
||||
|
|
|
@ -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, scp_options = nil)
|
||||
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, scp_options)
|
||||
end
|
||||
|
||||
def username
|
||||
|
|
|
@ -151,13 +151,13 @@ module Fog
|
|||
end
|
||||
end
|
||||
|
||||
def scp(local_path, remote_path)
|
||||
def scp(local_path, remote_path, scp_options = nil)
|
||||
raise 'Not Implemented'
|
||||
# requires :addresses, :username
|
||||
#
|
||||
#
|
||||
# options = {}
|
||||
# options[:key_data] = [private_key] if private_key
|
||||
# Fog::SCP.new(addresses['public'].first, username, options).upload(local_path, remote_path)
|
||||
# Fog::SCP.new(addresses['public'].first, username, options).upload(local_path, remote_path, scp_options)
|
||||
end
|
||||
|
||||
def setup(credentials = {})
|
||||
|
@ -178,7 +178,7 @@ module Fog
|
|||
def ssh(commands)
|
||||
raise 'Not Implemented'
|
||||
# requires :addresses, :identity, :username
|
||||
#
|
||||
#
|
||||
# options = {}
|
||||
# options[:key_data] = [private_key] if private_key
|
||||
# Fog::SSH.new(addresses['public'].first, username, options).run(commands)
|
||||
|
|
|
@ -23,7 +23,7 @@ module Fog
|
|||
@options = options
|
||||
end
|
||||
|
||||
def upload(local_path, remote_path)
|
||||
def upload(local_path, remote_path, scp_options)
|
||||
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, scp_options = nil)
|
||||
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, scp_options) do |ch, name, sent, total|
|
||||
# TODO: handle progress display?
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue