Class: Toolshed::ServerAdministration::SSH
- Inherits:
-
Object
- Object
- Toolshed::ServerAdministration::SSH
- Defined in:
- lib/toolshed/server_administration/ssh.rb
Instance Attribute Summary collapse
-
#channel ⇒ Object
Returns the value of attribute channel.
-
#commands ⇒ Object
Returns the value of attribute commands.
-
#host ⇒ Object
Returns the value of attribute host.
-
#keys ⇒ Object
Returns the value of attribute keys.
-
#password ⇒ Object
Returns the value of attribute password.
-
#ssh_options ⇒ Object
Returns the value of attribute ssh_options.
-
#sudo_password ⇒ Object
Returns the value of attribute sudo_password.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(options = {}) ⇒ SSH
constructor
A new instance of SSH.
Constructor Details
#initialize(options = {}) ⇒ SSH
Returns a new instance of SSH.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/toolshed/server_administration/ssh.rb', line 8 def initialize(={}) self.password = [:password] ||= '' self.sudo_password = [:sudo_password] ||= '' self.keys = [:keys] ||= '' self.host = [:host] ||= '' self.user = [:user] ||= '' self. = [:ssh_options] ||= {} self.commands = [:commands] ||= '' self.password = Toolshed::Password.new() end |
Instance Attribute Details
#channel ⇒ Object
Returns the value of attribute channel.
6 7 8 |
# File 'lib/toolshed/server_administration/ssh.rb', line 6 def channel @channel end |
#commands ⇒ Object
Returns the value of attribute commands.
6 7 8 |
# File 'lib/toolshed/server_administration/ssh.rb', line 6 def commands @commands end |
#host ⇒ Object
Returns the value of attribute host.
6 7 8 |
# File 'lib/toolshed/server_administration/ssh.rb', line 6 def host @host end |
#keys ⇒ Object
Returns the value of attribute keys.
6 7 8 |
# File 'lib/toolshed/server_administration/ssh.rb', line 6 def keys @keys end |
#password ⇒ Object
Returns the value of attribute password.
6 7 8 |
# File 'lib/toolshed/server_administration/ssh.rb', line 6 def password @password end |
#ssh_options ⇒ Object
Returns the value of attribute ssh_options.
6 7 8 |
# File 'lib/toolshed/server_administration/ssh.rb', line 6 def end |
#sudo_password ⇒ Object
Returns the value of attribute sudo_password.
6 7 8 |
# File 'lib/toolshed/server_administration/ssh.rb', line 6 def sudo_password @sudo_password end |
#user ⇒ Object
Returns the value of attribute user.
6 7 8 |
# File 'lib/toolshed/server_administration/ssh.rb', line 6 def user @user end |
Instance Method Details
#execute ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/toolshed/server_administration/ssh.rb', line 21 def execute Net::SSH.start(self.host, self.user, self.) do |ssh| ssh.open_channel do |channel| self.channel = channel request_pty run_commands end ssh.loop end end |