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 2016/04/19 20:45:41 UTC

[3/8] libcloud git commit: Fix pylint violations and some actual code bugs discovered by pylint.

Fix pylint violations and some actual code bugs discovered by pylint.


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

Branch: refs/heads/trunk
Commit: 1a8189d673bc5172fc30a09bf4c70d162f15ff34
Parents: c231005
Author: Tomaz Muraus <to...@tomaz.me>
Authored: Tue Apr 19 19:15:52 2016 +0200
Committer: Tomaz Muraus <to...@tomaz.me>
Committed: Tue Apr 19 19:16:46 2016 +0200

----------------------------------------------------------------------
 libcloud/dns/drivers/cloudflare.py | 1 +
 libcloud/dns/drivers/google.py     | 1 +
 libcloud/dns/drivers/liquidweb.py  | 7 ++++---
 libcloud/dns/drivers/nsone.py      | 2 +-
 libcloud/dns/drivers/powerdns.py   | 6 +++---
 libcloud/dns/drivers/softlayer.py  | 2 ++
 6 files changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/1a8189d6/libcloud/dns/drivers/cloudflare.py
----------------------------------------------------------------------
diff --git a/libcloud/dns/drivers/cloudflare.py b/libcloud/dns/drivers/cloudflare.py
index ee2d8eb..7d1e035 100644
--- a/libcloud/dns/drivers/cloudflare.py
+++ b/libcloud/dns/drivers/cloudflare.py
@@ -67,6 +67,7 @@ class CloudFlareDNSResponse(JsonResponse):
 
     def parse_body(self):
         body = super(CloudFlareDNSResponse, self).parse_body()
+        body = body or {}
 
         result = body.get('result', None)
         error_code = body.get('err_code', None)

http://git-wip-us.apache.org/repos/asf/libcloud/blob/1a8189d6/libcloud/dns/drivers/google.py
----------------------------------------------------------------------
diff --git a/libcloud/dns/drivers/google.py b/libcloud/dns/drivers/google.py
index d0aebcb..3f625cb 100644
--- a/libcloud/dns/drivers/google.py
+++ b/libcloud/dns/drivers/google.py
@@ -294,6 +294,7 @@ class GoogleDNSDriver(DNSDriver):
         request = '/managedZones/%s/changes' % (zone.id)
         response = self.connection.request(request, method='POST',
                                            data=records).object
+        response = response or {}
 
         response_data = {
             'additions': self._to_records(response.get('additions', []), zone),

http://git-wip-us.apache.org/repos/asf/libcloud/blob/1a8189d6/libcloud/dns/drivers/liquidweb.py
----------------------------------------------------------------------
diff --git a/libcloud/dns/drivers/liquidweb.py b/libcloud/dns/drivers/liquidweb.py
index 803849a..d9415b3 100644
--- a/libcloud/dns/drivers/liquidweb.py
+++ b/libcloud/dns/drivers/liquidweb.py
@@ -176,11 +176,12 @@ class LiquidWebDNSDriver(DNSDriver):
         https://www.liquidweb.com/storm/api/docs/v1/Network/DNS/Zone.html
         """
         action = '/v1/Network/DNS/Zone/create'
-        data = json.dumps({'params': {'name': domain}})
+        data = {'params': {'name': domain}}
+
         if extra is not None:
-            params = data.get('params')
-            params.update(extra)
+            data['params'].update(extra)
         try:
+            data = json.dumps(data)
             response = self.connection.request(action=action,
                                                method='POST',
                                                data=data)

http://git-wip-us.apache.org/repos/asf/libcloud/blob/1a8189d6/libcloud/dns/drivers/nsone.py
----------------------------------------------------------------------
diff --git a/libcloud/dns/drivers/nsone.py b/libcloud/dns/drivers/nsone.py
index 08dcd8b..0233975 100644
--- a/libcloud/dns/drivers/nsone.py
+++ b/libcloud/dns/drivers/nsone.py
@@ -292,7 +292,7 @@ class NsOneDNSDriver(DNSDriver):
             e = sys.exc_info()[1]
             if e.message == 'record does not exist':
                 raise RecordDoesNotExistError(value=e.message, driver=self,
-                                              id=record.id)
+                                              record_id=record.id)
             else:
                 raise e
         record = self._to_record(item=response.parse_body(), zone=zone)

http://git-wip-us.apache.org/repos/asf/libcloud/blob/1a8189d6/libcloud/dns/drivers/powerdns.py
----------------------------------------------------------------------
diff --git a/libcloud/dns/drivers/powerdns.py b/libcloud/dns/drivers/powerdns.py
index 56e2381..37bd37c 100644
--- a/libcloud/dns/drivers/powerdns.py
+++ b/libcloud/dns/drivers/powerdns.py
@@ -141,9 +141,9 @@ class PowerDNSDriver(DNSDriver):
             raise NotImplementedError('Unsupported API version: %s' %
                                       api_version)
 
-        return super(PowerDNSDriver, self).__init__(key=key, secure=secure,
-                                                    host=host, port=port,
-                                                    **kwargs)
+        super(PowerDNSDriver, self).__init__(key=key, secure=secure,
+                                             host=host, port=port,
+                                             **kwargs)
 
     def create_record(self, name, zone, type, data, extra=None):
         """

http://git-wip-us.apache.org/repos/asf/libcloud/blob/1a8189d6/libcloud/dns/drivers/softlayer.py
----------------------------------------------------------------------
diff --git a/libcloud/dns/drivers/softlayer.py b/libcloud/dns/drivers/softlayer.py
index 8a3cf4c..bfe7776 100644
--- a/libcloud/dns/drivers/softlayer.py
+++ b/libcloud/dns/drivers/softlayer.py
@@ -12,6 +12,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+# pylint: disable=unexpected-keyword-arg
+
 __all__ = [
     'SoftLayerDNSDriver'
 ]