You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by pq...@apache.org on 2010/04/22 22:05:01 UTC

svn commit: r937041 - in /incubator/libcloud/trunk/libcloud: base.py drivers/ec2.py

Author: pquerna
Date: Thu Apr 22 20:05:01 2010
New Revision: 937041

URL: http://svn.apache.org/viewvc?rev=937041&view=rev
Log:
Add support for specifying the port used for an eucalyptus cluster endpoint.

Modified:
    incubator/libcloud/trunk/libcloud/base.py
    incubator/libcloud/trunk/libcloud/drivers/ec2.py

Modified: incubator/libcloud/trunk/libcloud/base.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/base.py?rev=937041&r1=937040&r2=937041&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/base.py (original)
+++ incubator/libcloud/trunk/libcloud/base.py Thu Apr 22 20:05:01 2010
@@ -320,7 +320,7 @@ class ConnectionKey(object):
     driver = None
     action = None
 
-    def __init__(self, key, secure=True, host=None):
+    def __init__(self, key, secure=True, host=None, force_port=None):
         """
         Initialize `user_id` and `key`; set `secure` to an C{int} based on
         passed value.
@@ -331,6 +331,9 @@ class ConnectionKey(object):
         if host:
           self.host = host
 
+        if force_port:
+          self.port = (force_port, force_port)
+
     def connect(self, host=None, port=None):
         """
         Establish a connection with the API server.
@@ -459,8 +462,8 @@ class ConnectionUserAndKey(ConnectionKey
 
     user_id = None
 
-    def __init__(self, user_id, key, secure=True, host=None):
-        super(ConnectionUserAndKey, self).__init__(key, secure, host)
+    def __init__(self, user_id, key, secure=True, host=None, port=None):
+        super(ConnectionUserAndKey, self).__init__(key, secure, host, port)
         self.user_id = user_id
 
 
@@ -474,6 +477,7 @@ class NodeDriver(object):
     connectionCls = ConnectionKey
     name = None
     type = None
+    port = None
     features = {"create_node": []}
     """
     List of available features for a driver.
@@ -485,7 +489,7 @@ class NodeDriver(object):
     """
     NODE_STATE_MAP = {}
 
-    def __init__(self, key, secret=None, secure=True, host=None):
+    def __init__(self, key, secret=None, secure=True, host=None, port=None):
         """
         @keyword    key:    API key or username to used
         @type       key:    str
@@ -510,6 +514,9 @@ class NodeDriver(object):
         if host:
           args.append(host)
 
+        if port:
+          args.append(port)
+
         self.connection = self.connectionCls(*args)
 
         self.connection.driver = self

Modified: incubator/libcloud/trunk/libcloud/drivers/ec2.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/drivers/ec2.py?rev=937041&r1=937040&r2=937041&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/drivers/ec2.py (original)
+++ incubator/libcloud/trunk/libcloud/drivers/ec2.py Thu Apr 22 20:05:01 2010
@@ -464,8 +464,8 @@ class EucNodeDriver(EC2NodeDriver):
     connectionCls = EucConnection
     _instance_types = EC2_US_WEST_INSTANCE_TYPES
 
-    def __init__(self, key, secret=None, secure=True, host=None, path=None):
-      super(EucNodeDriver, self).__init__(key, secret, secure, host)
+    def __init__(self, key, secret=None, secure=True, host=None, path=None, port=None):
+      super(EucNodeDriver, self).__init__(key, secret, secure, host, port)
       if path:
         self.path = path