You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2014/07/30 23:22:39 UTC

git commit: Fix an issue with LIBCLOUD_DEBUG not working correctly with the Linode driver.

Repository: libcloud
Updated Branches:
  refs/heads/trunk ff05bdbae -> eec3cc2b0


Fix an issue with LIBCLOUD_DEBUG not working correctly with the
Linode driver.

Closes #342


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

Branch: refs/heads/trunk
Commit: eec3cc2b0edf93e547739534869f4f4c23244e4e
Parents: ff05bdb
Author: Tomaz Muraus <to...@apache.org>
Authored: Wed Jul 30 23:16:11 2014 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Wed Jul 30 23:16:11 2014 +0200

----------------------------------------------------------------------
 CHANGES.rst               |  5 +++++
 libcloud/common/linode.py | 12 ++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/eec3cc2b/CHANGES.rst
----------------------------------------------------------------------
diff --git a/CHANGES.rst b/CHANGES.rst
index 5282f0b..6de450b 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -7,6 +7,11 @@ Changes with Apache Libcloud in development
 Compute
 ~~~~~~~
 
+- Fix an issue with ``LIBCLOUD_DEBUG`` not working correctly with the
+  Linode driver.
+  [Tomaz Muraus, Juan Carlos Moreno]
+  (LIBCLOUD-598, GITHUB-342)
+
 - Add new driver for VMware vSphere (http://www.vmware.com/products/vsphere/)
   based clouds.
   [Tomaz Muraus]

http://git-wip-us.apache.org/repos/asf/libcloud/blob/eec3cc2b/libcloud/common/linode.py
----------------------------------------------------------------------
diff --git a/libcloud/common/linode.py b/libcloud/common/linode.py
index f7ee22b..6ee9cc6 100644
--- a/libcloud/common/linode.py
+++ b/libcloud/common/linode.py
@@ -87,8 +87,16 @@ class LinodeResponse(JsonResponse):
         self.error = response.reason
         self.status = response.status
 
-        self.body = self._decompress_response(body=response.read(),
-                                              headers=self.headers)
+        # This attribute is set when using LoggingConnection.
+        original_data = getattr(response, '_original_data', None)
+
+        if original_data:
+            # LoggingConnection already decompresses data so it can log it
+            # which means we don't need to decompress it here.
+            self.body = response._original_data
+        else:
+            self.body = self._decompress_response(body=response.read(),
+                                                  headers=self.headers)
 
         if PY3:
             self.body = b(self.body).decode('utf-8')