libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject [5/6] libcloud git commit: Changes to remove __init__ masking access to base class proxy_url
Date Fri, 25 Sep 2015 11:13:12 GMT
Changes to remove __init__ masking access to base class proxy_url

Unit tests were failing as specific Connection classes were masking
access to the proxy_url property of the base Connection class.

Signed-off-by: Tomaz Muraus <tomaz@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/44fa6eb7
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/44fa6eb7
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/44fa6eb7

Branch: refs/heads/trunk
Commit: 44fa6eb77af27205202db3fd77e769f313556959
Parents: 54eaf03
Author: MrBasset <daniel.pool@gmail.com>
Authored: Mon Sep 21 22:47:04 2015 -0400
Committer: Tomaz Muraus <tomaz@apache.org>
Committed: Fri Sep 25 12:57:51 2015 +0200

----------------------------------------------------------------------
 libcloud/common/abiquo.py               | 4 ++--
 libcloud/common/aws.py                  | 8 ++++----
 libcloud/common/base.py                 | 4 ++--
 libcloud/common/gandi.py                | 4 ++--
 libcloud/common/openstack.py            | 4 ++--
 libcloud/compute/drivers/cloudframes.py | 4 ++--
 libcloud/compute/drivers/vcloud.py      | 2 +-
 libcloud/test/__init__.py               | 5 +++++
 8 files changed, 20 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/44fa6eb7/libcloud/common/abiquo.py
----------------------------------------------------------------------
diff --git a/libcloud/common/abiquo.py b/libcloud/common/abiquo.py
index c0a52fd..3846e47 100644
--- a/libcloud/common/abiquo.py
+++ b/libcloud/common/abiquo.py
@@ -181,13 +181,13 @@ class AbiquoConnection(ConnectionUserAndKey, PollingConnection):
 
     def __init__(self, user_id, key, secure=True, host=None, port=None,
                  url=None, timeout=None,
-                 retry_delay=None, backoff=None):
+                 retry_delay=None, backoff=None, proxy_url=None):
         super(AbiquoConnection, self).__init__(user_id=user_id, key=key,
                                                secure=secure,
                                                host=host, port=port,
                                                url=url, timeout=timeout,
                                                retry_delay=retry_delay,
-                                               backoff=backoff)
+                                               backoff=backoff, proxy_url=proxy_url)
 
         # This attribute stores data cached across multiple request
         self.cache = {}

http://git-wip-us.apache.org/repos/asf/libcloud/blob/44fa6eb7/libcloud/common/aws.py
----------------------------------------------------------------------
diff --git a/libcloud/common/aws.py b/libcloud/common/aws.py
index 7a48e24..5933c88 100644
--- a/libcloud/common/aws.py
+++ b/libcloud/common/aws.py
@@ -128,14 +128,14 @@ class AWSGenericResponse(AWSBaseResponse):
 
 class AWSTokenConnection(ConnectionUserAndKey):
     def __init__(self, user_id, key, secure=True,
-                 host=None, port=None, url=None, timeout=None, token=None,
+                 host=None, port=None, url=None, timeout=None, proxy_url=None, token=None,
                  retry_delay=None, backoff=None):
         self.token = token
         super(AWSTokenConnection, self).__init__(user_id, key, secure=secure,
                                                  host=host, port=port, url=url,
                                                  timeout=timeout,
                                                  retry_delay=retry_delay,
-                                                 backoff=backoff)
+                                                 backoff=backoff, proxy_url=proxy_url)
 
     def add_default_params(self, params):
         # Even though we are adding it to the headers, we need it here too
@@ -328,14 +328,14 @@ class AWSRequestSignerAlgorithmV4(AWSRequestSigner):
 
 class SignedAWSConnection(AWSTokenConnection):
     def __init__(self, user_id, key, secure=True, host=None, port=None,
-                 url=None, timeout=None, token=None, retry_delay=None,
+                 url=None, timeout=None, proxy_url=None, token=None, retry_delay=None,
                  backoff=None, signature_version=DEFAULT_SIGNATURE_VERSION):
         super(SignedAWSConnection, self).__init__(user_id=user_id, key=key,
                                                   secure=secure, host=host,
                                                   port=port, url=url,
                                                   timeout=timeout, token=token,
                                                   retry_delay=retry_delay,
-                                                  backoff=backoff)
+                                                  backoff=backoff, proxy_url=proxy_url)
         self.signature_version = str(signature_version)
 
         if self.signature_version == '2':

http://git-wip-us.apache.org/repos/asf/libcloud/blob/44fa6eb7/libcloud/common/base.py
----------------------------------------------------------------------
diff --git a/libcloud/common/base.py b/libcloud/common/base.py
index 929a43f..c513dee 100644
--- a/libcloud/common/base.py
+++ b/libcloud/common/base.py
@@ -1006,7 +1006,7 @@ class CertificateConnection(Connection):
     """
     Base connection class which accepts a single ``cert_file`` argument.
     """
-    def __init__(self, cert_file, secure=True, host=None, port=None, url=None,
+    def __init__(self, cert_file, secure=True, host=None, port=None, url=None, proxy_url=None,
                  timeout=None, backoff=None, retry_delay=None):
         """
         Initialize `cert_file`; set `secure` to an ``int`` based on
@@ -1016,7 +1016,7 @@ class CertificateConnection(Connection):
                                                     port=port, url=url,
                                                     timeout=timeout,
                                                     backoff=backoff,
-                                                    retry_delay=retry_delay)
+                                                    retry_delay=retry_delay, proxy_url=proxy_url)
 
         self.cert_file = cert_file
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/44fa6eb7/libcloud/common/gandi.py
----------------------------------------------------------------------
diff --git a/libcloud/common/gandi.py b/libcloud/common/gandi.py
index 7155f4a..91c1a2b 100644
--- a/libcloud/common/gandi.py
+++ b/libcloud/common/gandi.py
@@ -58,7 +58,7 @@ class GandiConnection(XMLRPCConnection, ConnectionKey):
     endpoint = '/xmlrpc/'
 
     def __init__(self, key, secure=True, timeout=None,
-                 retry_delay=None, backoff=None):
+                 retry_delay=None, backoff=None, proxy_url=None):
         # Note: Method resolution order in this case is
         # XMLRPCConnection -> Connection and Connection doesn't take key as the
         # first argument so we specify a keyword argument instead.
@@ -66,7 +66,7 @@ class GandiConnection(XMLRPCConnection, ConnectionKey):
         super(GandiConnection, self).__init__(key=key, secure=secure,
                                               timeout=timeout,
                                               retry_delay=retry_delay,
-                                              backoff=backoff)
+                                              backoff=backoff, proxy_url=proxy_url)
         self.driver = BaseGandiDriver
 
     def request(self, method, *args):

http://git-wip-us.apache.org/repos/asf/libcloud/blob/44fa6eb7/libcloud/common/openstack.py
----------------------------------------------------------------------
diff --git a/libcloud/common/openstack.py b/libcloud/common/openstack.py
index 4e8d6fc..646a7de 100644
--- a/libcloud/common/openstack.py
+++ b/libcloud/common/openstack.py
@@ -122,7 +122,7 @@ class OpenStackBaseConnection(ConnectionUserAndKey):
     _auth_version = None
 
     def __init__(self, user_id, key, secure=True,
-                 host=None, port=None, timeout=None,
+                 host=None, port=None, timeout=None, proxy_url=None,
                  ex_force_base_url=None,
                  ex_force_auth_url=None,
                  ex_force_auth_version=None,
@@ -134,7 +134,7 @@ class OpenStackBaseConnection(ConnectionUserAndKey):
                  retry_delay=None, backoff=None):
         super(OpenStackBaseConnection, self).__init__(
             user_id, key, secure=secure, timeout=timeout,
-            retry_delay=retry_delay, backoff=backoff)
+            retry_delay=retry_delay, backoff=backoff, proxy_url=proxy_url)
 
         if ex_force_auth_version:
             self._auth_version = ex_force_auth_version

http://git-wip-us.apache.org/repos/asf/libcloud/blob/44fa6eb7/libcloud/compute/drivers/cloudframes.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/cloudframes.py b/libcloud/compute/drivers/cloudframes.py
index 6aca784..4a2f4aa 100644
--- a/libcloud/compute/drivers/cloudframes.py
+++ b/libcloud/compute/drivers/cloudframes.py
@@ -117,7 +117,7 @@ class CloudFramesConnection(XMLRPCConnection, ConnectionKey):
 
     def __init__(self, key=None, secret=None, secure=True,
                  host=None, port=None, url=None, timeout=None,
-                 retry_delay=None, backoff=None):
+                 retry_delay=None, backoff=None, proxy_url=None):
         """
         :param    key:    The username to connect with to the cloudapi
         :type     key:    ``str``
@@ -142,7 +142,7 @@ class CloudFramesConnection(XMLRPCConnection, ConnectionKey):
                                                     host=host, port=port,
                                                     url=url, timeout=timeout,
                                                     retry_delay=retry_delay,
-                                                    backoff=backoff)
+                                                    backoff=backoff, proxy_url=proxy_url)
         self._auth = base64.b64encode(
             b('%s:%s' % (key, secret))).decode('utf-8')
         self.endpoint = url

http://git-wip-us.apache.org/repos/asf/libcloud/blob/44fa6eb7/libcloud/compute/drivers/vcloud.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/vcloud.py b/libcloud/compute/drivers/vcloud.py
index bbb3ed4..efe33e4 100644
--- a/libcloud/compute/drivers/vcloud.py
+++ b/libcloud/compute/drivers/vcloud.py
@@ -848,7 +848,7 @@ class VCloud_1_5_Connection(VCloudConnection):
                      'application/vnd.vmware.vcloud.orgList+xml')).get('href')
             )
 
-            self.connection.set_http_proxy ( self.proxy_url )
+            self.connection.set_http_proxy(self.proxy_url)
             self.connection.request(method='GET', url=org_list_url,
                                     headers=self.add_default_headers({}))
             body = ET.XML(self.connection.getresponse().read())

http://git-wip-us.apache.org/repos/asf/libcloud/blob/44fa6eb7/libcloud/test/__init__.py
----------------------------------------------------------------------
diff --git a/libcloud/test/__init__.py b/libcloud/test/__init__.py
index 3a701cd..6723ee9 100644
--- a/libcloud/test/__init__.py
+++ b/libcloud/test/__init__.py
@@ -166,6 +166,8 @@ class MockHttp(BaseMockHttpObject):
 
     test = None  # TestCase instance which is using this mock
 
+    proxy_url = None
+
     def __init__(self, host, port, *args, **kwargs):
         self.host = host
         self.port = port
@@ -201,6 +203,9 @@ class MockHttp(BaseMockHttpObject):
     def close(self):
         pass
 
+    def set_http_proxy (self, proxy_url):
+        self.proxy_url = proxy_url
+
     # Mock request/response example
     def _example(self, method, url, body, headers):
         """


Mime
View raw message