Class: CapBase
- Inherits:
-
Object
- Object
- CapBase
- Defined in:
- lib/addon/cap_base.rb
Instance Attribute Summary collapse
-
#servers ⇒ Object
readonly
Returns the value of attribute servers.
-
#servers_by_hash ⇒ Object
readonly
Returns the value of attribute servers_by_hash.
Instance Method Summary collapse
-
#initialize(server_hash) ⇒ CapBase
constructor
A new instance of CapBase.
Constructor Details
#initialize(server_hash) ⇒ CapBase
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/addon/cap_base.rb', line 9 def initialize server_hash @servers = [] @servers_by_hash = {} server_hash.each do |name, hash| args = [:host,:user,:port,:password].each_with_object({}) do |key, h| if key == :host h[:hostname] = hash[key] else h[key] = hash[key] if hash.has_key? key end end # host = SSHKit::Host.new :hostname => hash[:host], :user => hash[:user], :password => hash[:password] host = SSHKit::Host.new args host.key = hash[:key] if hash.has_key? :key #use ssh private key file host.properties. = hash @servers.push host @servers_by_hash[name] = host end end |
Instance Attribute Details
#servers ⇒ Object (readonly)
Returns the value of attribute servers.
8 9 10 |
# File 'lib/addon/cap_base.rb', line 8 def servers @servers end |
#servers_by_hash ⇒ Object (readonly)
Returns the value of attribute servers_by_hash.
8 9 10 |
# File 'lib/addon/cap_base.rb', line 8 def servers_by_hash @servers_by_hash end |