libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject [libcloud] 13/14: Correctly handle region being None.
Date Sun, 04 Oct 2020 15:39:32 GMT
This is an automated email from the ASF dual-hosted git repository.

tomaz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git

commit 4b95eeff90817bea3a8c2d99593418b54269cfc1
Author: Tomaz Muraus <tomaz@tomaz.me>
AuthorDate: Sun Oct 4 17:34:44 2020 +0200

    Correctly handle region being None.
---
 libcloud/common/ovh.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libcloud/common/ovh.py b/libcloud/common/ovh.py
index 5dd0687..a9c11af 100644
--- a/libcloud/common/ovh.py
+++ b/libcloud/common/ovh.py
@@ -111,8 +111,12 @@ class OvhConnection(ConnectionUserAndKey):
     allow_insecure = True
 
     def __init__(self, user_id, *args, **kwargs):
-        self.host = ('%s.%s' % (kwargs.pop('region', ''),
-                                API_HOST)).lstrip('.')
+        region = kwargs.pop('region', '')
+        if region:
+            self.host = ('%s.%s' % (region,
+                                    API_HOST)).lstrip('.')
+        else:
+            self.host = API_HOST
         self.consumer_key = kwargs.pop('ex_consumer_key', None)
         if self.consumer_key is None:
             consumer_key_json = self.request_consumer_key(user_id)


Mime
View raw message