libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject [libcloud] 10/14: Fix invalid usage of JsonResponse class on the Ovh driver - we need to use OvhResponse class to parse_error() is correctly used.
Date Sun, 04 Oct 2020 15:39:29 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 ae8245ff9e2e434c0f23c869072a751c10e7e09f
Author: Tomaz Muraus <tomaz@tomaz.me>
AuthorDate: Sun Oct 4 17:11:06 2020 +0200

    Fix invalid usage of JsonResponse class on the Ovh driver - we need to
    use OvhResponse class to parse_error() is correctly used.
    
    Before that on invalid credentials user would receive this error:
    
    libcloud.common.exceptions.BaseHTTPError: <exception str() failed>
    
    Now a correct error is returned:
    
    libcloud.common.exceptions.BaseHTTPError: {"message":"Invalid application key"}
---
 libcloud/common/ovh.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libcloud/common/ovh.py b/libcloud/common/ovh.py
index 822395d..7d11917 100644
--- a/libcloud/common/ovh.py
+++ b/libcloud/common/ovh.py
@@ -146,6 +146,8 @@ class OvhConnection(ConnectionUserAndKey):
                                  'Used host: %s. Original error: %s' %
                                  (self.host, str(e)))
 
+        response = OvhResponse(httpcon.getresponse(), httpcon)
+
         if response.status == httplib.UNAUTHORIZED:
             raise InvalidCredsError()
 


Mime
View raw message