Class: DbDumper::RemoteMachine::SshAgent
- Inherits:
-
Object
- Object
- DbDumper::RemoteMachine::SshAgent
- Defined in:
- lib/db_dumper/remote_machine/ssh_agent.rb
Overview
Wrapper around Net::SSH, Net:SCP
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#ssh ⇒ Object
readonly
Returns the value of attribute ssh.
Instance Method Summary collapse
- #download!(remote_source, local_dest, options = {}) ⇒ Object
- #exec!(command) ⇒ Object
-
#initialize(config, &block) ⇒ SshAgent
constructor
A new instance of SshAgent.
- #upload!(local_source, remote_dest, options = {}) ⇒ Object
Constructor Details
#initialize(config, &block) ⇒ SshAgent
Returns a new instance of SshAgent.
9 10 11 12 13 |
# File 'lib/db_dumper/remote_machine/ssh_agent.rb', line 9 def initialize(config, &block) @config = config @block = block @ssh = Net::SSH.start(*credentials) end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
7 8 9 |
# File 'lib/db_dumper/remote_machine/ssh_agent.rb', line 7 def block @block end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
6 7 8 |
# File 'lib/db_dumper/remote_machine/ssh_agent.rb', line 6 def config @config end |
#ssh ⇒ Object (readonly)
Returns the value of attribute ssh.
7 8 9 |
# File 'lib/db_dumper/remote_machine/ssh_agent.rb', line 7 def ssh @ssh end |
Instance Method Details
#download!(remote_source, local_dest, options = {}) ⇒ Object
20 21 22 23 |
# File 'lib/db_dumper/remote_machine/ssh_agent.rb', line 20 def download!(remote_source, local_dest, = {}) log("DOWNLOADING from #{ssh_machine_name}:#{remote_source} to #{local_dest}") log ssh.scp.download!(remote_source, local_dest, ) end |
#exec!(command) ⇒ Object
15 16 17 18 |
# File 'lib/db_dumper/remote_machine/ssh_agent.rb', line 15 def exec!(command) log("EXECUTING on #{ssh_machine_name}: #{command}") log ssh.exec!(command) end |
#upload!(local_source, remote_dest, options = {}) ⇒ Object
25 26 27 28 |
# File 'lib/db_dumper/remote_machine/ssh_agent.rb', line 25 def upload!(local_source, remote_dest, = {}) log("uploading from #{ssh_machine_name}:#{local_source} to #{remote_dest}") log ssh.scp.upload!(local_source, remote_dest, ) end |