Class: Pangea::Link
- Inherits:
-
Object
- Object
- Pangea::Link
- Defined in:
- lib/pangea/objects.rb
Overview
Link is the connection to the hypervisor
Every Link is associated to one host
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
:nodoc:.
-
#connected ⇒ Object
readonly
:nodoc:.
-
#sid ⇒ Object
readonly
:nodoc:.
-
#url ⇒ Object
readonly
:nodoc:.
Instance Method Summary collapse
- #connect ⇒ Object
-
#initialize(url, username = 'foo', password = 'bar') ⇒ Link
constructor
A new instance of Link.
Constructor Details
#initialize(url, username = 'foo', password = 'bar') ⇒ Link
Returns a new instance of Link.
12 13 14 15 16 |
# File 'lib/pangea/objects.rb', line 12 def initialize(url, username='foo', password='bar') @xmlrpc_url = url @username = username @password = password end |
Instance Attribute Details
#client ⇒ Object (readonly)
:nodoc:
10 11 12 |
# File 'lib/pangea/objects.rb', line 10 def client @client end |
#connected ⇒ Object (readonly)
:nodoc:
10 11 12 |
# File 'lib/pangea/objects.rb', line 10 def connected @connected end |
#sid ⇒ Object (readonly)
:nodoc:
10 11 12 |
# File 'lib/pangea/objects.rb', line 10 def sid @sid end |
#url ⇒ Object (readonly)
:nodoc:
10 11 12 |
# File 'lib/pangea/objects.rb', line 10 def url @url end |
Instance Method Details
#connect ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/pangea/objects.rb', line 18 def connect #puts "hyperlinking to #{@xmlrpc_url}" $stdout.flush begin @client = XMLRPC::Client.new2(@xmlrpc_url) @session = @client.proxy('session') @sid = @session.login_with_password(@username, @password)['Value'] @connected = true rescue Exception => e raise LinkConnectError.new("Error connecting to the hypervisor #{@xmlrpc_url} (#{e.})") end end |