libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject [2/2] libcloud git commit: Fix lint and Pycon version compatibility issues.
Date Sun, 22 Feb 2015 11:51:44 GMT
Fix lint and Pycon version compatibility issues.


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

Branch: refs/heads/trunk
Commit: 968425c62da91b271b04975c5fa5b062f88594f6
Parents: fe0ad78
Author: Tomaz Muraus <tomaz@apache.org>
Authored: Sun Feb 22 12:49:23 2015 +0100
Committer: Tomaz Muraus <tomaz@apache.org>
Committed: Sun Feb 22 12:49:23 2015 +0100

----------------------------------------------------------------------
 libcloud/dns/drivers/hostvirtual.py | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/968425c6/libcloud/dns/drivers/hostvirtual.py
----------------------------------------------------------------------
diff --git a/libcloud/dns/drivers/hostvirtual.py b/libcloud/dns/drivers/hostvirtual.py
index 400844c..71973c9 100644
--- a/libcloud/dns/drivers/hostvirtual.py
+++ b/libcloud/dns/drivers/hostvirtual.py
@@ -16,6 +16,13 @@ __all__ = [
     'HostVirtualDNSDriver'
 ]
 
+import sys
+
+try:
+    import simplejson as json
+except:
+    import json
+
 from libcloud.utils.py3 import httplib
 from libcloud.utils.misc import merge_valid_keys, get_new_obj
 from libcloud.common.hostvirtual import HostVirtualResponse
@@ -25,11 +32,6 @@ from libcloud.dns.types import Provider, RecordType
 from libcloud.dns.types import ZoneDoesNotExistError, RecordDoesNotExistError
 from libcloud.dns.base import DNSDriver, Zone, Record
 
-try:
-    import simplejson as json
-except:
-    import json
-
 VALID_RECORD_EXTRA_PARAMS = ['prio', 'ttl']
 
 
@@ -42,7 +44,7 @@ class HostVirtualDNSResponse(HostVirtualResponse):
             if context['resource'] == 'zone':
                 raise ZoneDoesNotExistError(
                     value=self.parse_body()['error']['message'],
-                    driver=self,zone_id=context['id'])
+                    driver=self, zone_id=context['id'])
             elif context['resource'] == 'record':
                 raise RecordDoesNotExistError(
                     value=self.parse_body()['error']['message'],
@@ -120,8 +122,9 @@ class HostVirtualDNSDriver(DNSDriver):
         try:
             result = self.connection.request(
                 API_ROOT + '/dns/records/', params=params).object
-        except ZoneDoesNotExistError as e:
-            if e.value == u'Not Found: No Records Found':
+        except ZoneDoesNotExistError:
+            e = sys.exc_info()[1]
+            if 'Not Found: No Records Found' in e.value:
                 return []
             raise e
         records = self._to_records(items=result, zone=zone)


Mime
View raw message