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 2020/11/05 22:28:53 UTC

[libcloud] branch trunk updated (29c8692 -> 9b72e75)

This is an automated email from the ASF dual-hosted git repository.

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


    from 29c8692  Add changelog entry.
     new 4c0daed  dns/digitalocean: send attributes in body for PUT and POST operations.
     new 8837ee7  Assert that requests contain bodies.
     new 63fba89  Merge branch 'do-dns-query-params' of https://github.com/andrewsomething/libcloud into andrewsomething-do-dns-query-params
     new cda0233  Add changelog entry.
     new 9b72e75  Make sure we return correct response status code on error.

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 CHANGES.rst                                               |  6 ++++++
 libcloud/dns/drivers/digitalocean.py                      |  8 +++++---
 .../digitalocean/_v2_domains_UNPROCESSABLE_ENTITY.json    |  1 +
 libcloud/test/dns/test_digitalocean.py                    | 15 ++++++++++++++-
 4 files changed, 26 insertions(+), 4 deletions(-)
 create mode 100644 libcloud/test/dns/fixtures/digitalocean/_v2_domains_UNPROCESSABLE_ENTITY.json


[libcloud] 03/05: Merge branch 'do-dns-query-params' of https://github.com/andrewsomething/libcloud into andrewsomething-do-dns-query-params

Posted by to...@apache.org.
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 63fba893d1de932a73e45458c9208a2350b4f281
Merge: 29c8692 8837ee7
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Thu Nov 5 23:08:36 2020 +0100

    Merge branch 'do-dns-query-params' of https://github.com/andrewsomething/libcloud into andrewsomething-do-dns-query-params

 libcloud/dns/drivers/digitalocean.py                      |  8 +++++---
 .../digitalocean/_v2_domains_UNPROCESSABLE_ENTITY.json    |  1 +
 libcloud/test/dns/test_digitalocean.py                    | 15 ++++++++++++++-
 3 files changed, 20 insertions(+), 4 deletions(-)


[libcloud] 02/05: Assert that requests contain bodies.

Posted by to...@apache.org.
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 8837ee72cd2202febc1589edc16fb8e85c4fcdfe
Author: Andrew Starr-Bochicchio <a....@gmail.com>
AuthorDate: Mon Nov 2 10:43:40 2020 -0500

    Assert that requests contain bodies.
---
 .../digitalocean/_v2_domains_UNPROCESSABLE_ENTITY.json    |  1 +
 libcloud/test/dns/test_digitalocean.py                    | 15 ++++++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/libcloud/test/dns/fixtures/digitalocean/_v2_domains_UNPROCESSABLE_ENTITY.json b/libcloud/test/dns/fixtures/digitalocean/_v2_domains_UNPROCESSABLE_ENTITY.json
new file mode 100644
index 0000000..102aa9d
--- /dev/null
+++ b/libcloud/test/dns/fixtures/digitalocean/_v2_domains_UNPROCESSABLE_ENTITY.json
@@ -0,0 +1 @@
+{"id":"unprocessable_entity","message":"Request body malformed."}
diff --git a/libcloud/test/dns/test_digitalocean.py b/libcloud/test/dns/test_digitalocean.py
index 453e9c3..7e2c54e 100644
--- a/libcloud/test/dns/test_digitalocean.py
+++ b/libcloud/test/dns/test_digitalocean.py
@@ -110,7 +110,8 @@ class DigitalOceanDNSMockHttp(MockHttp):
         'EMPTY': httplib.OK,
         'NOT_FOUND': httplib.NOT_FOUND,
         'UNAUTHORIZED': httplib.UNAUTHORIZED,
-        'UPDATE': httplib.OK
+        'UPDATE': httplib.OK,
+        'UNPROCESSABLE': httplib.UNPROCESSABLE_ENTITY,
     }
 
     def _v2_domains(self, method, url, body, headers):
@@ -119,6 +120,10 @@ class DigitalOceanDNSMockHttp(MockHttp):
                 httplib.responses[self.response_map[self.type]])
 
     def _v2_domains_CREATE(self, method, url, body, headers):
+        if body is None:
+            body = self.fixtures.load('_v2_domains_UNPROCESSABLE_ENTITY.json')
+            return (self.response_map[self.type], body, {},
+                    httplib.responses[self.response_map['UNPROCESSABLE']])
         body = self.fixtures.load('_v2_domains_CREATE.json')
         return (self.response_map[self.type], body, {},
                 httplib.responses[self.response_map[self.type]])
@@ -144,6 +149,10 @@ class DigitalOceanDNSMockHttp(MockHttp):
 
     def _v2_domains_testdomain_records_CREATE(self, method, url,
                                               body, headers):
+        if body is None:
+            body = self.fixtures.load('_v2_domains_UNPROCESSABLE_ENTITY.json')
+            return (self.response_map[self.type], body, {},
+                    httplib.responses[self.response_map['UNPROCESSABLE']])
         body = self.fixtures.load('_v2_domains_testdomain_records_CREATE.json')
         return (self.response_map[self.type], body, {},
                 httplib.responses[self.response_map[self.type]])
@@ -163,6 +172,10 @@ class DigitalOceanDNSMockHttp(MockHttp):
 
     def _v2_domains_testdomain_records_1234564_UPDATE(
             self, method, url, body, headers):
+        if body is None:
+            body = self.fixtures.load('_v2_domains_UNPROCESSABLE_ENTITY.json')
+            return (self.response_map[self.type], body, {},
+                    httplib.responses[self.response_map['UNPROCESSABLE']])
         body = self.fixtures.load(
             '_v2_domains_testdomain_records_1234564_UPDATE.json')
         return (self.response_map[self.type], body, {},


[libcloud] 05/05: Make sure we return correct response status code on error.

Posted by to...@apache.org.
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 9b72e75ca1413cd7c37ad30b9f0ae20f6b06c7a8
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Thu Nov 5 23:25:07 2020 +0100

    Make sure we return correct response status code on error.
---
 libcloud/test/dns/test_digitalocean.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libcloud/test/dns/test_digitalocean.py b/libcloud/test/dns/test_digitalocean.py
index 7e2c54e..7a4e7c1 100644
--- a/libcloud/test/dns/test_digitalocean.py
+++ b/libcloud/test/dns/test_digitalocean.py
@@ -122,7 +122,7 @@ class DigitalOceanDNSMockHttp(MockHttp):
     def _v2_domains_CREATE(self, method, url, body, headers):
         if body is None:
             body = self.fixtures.load('_v2_domains_UNPROCESSABLE_ENTITY.json')
-            return (self.response_map[self.type], body, {},
+            return (self.response_map['UNPROCESSABLE'], body, {},
                     httplib.responses[self.response_map['UNPROCESSABLE']])
         body = self.fixtures.load('_v2_domains_CREATE.json')
         return (self.response_map[self.type], body, {},
@@ -151,7 +151,7 @@ class DigitalOceanDNSMockHttp(MockHttp):
                                               body, headers):
         if body is None:
             body = self.fixtures.load('_v2_domains_UNPROCESSABLE_ENTITY.json')
-            return (self.response_map[self.type], body, {},
+            return (self.response_map['UNPROCESSABLE'], body, {},
                     httplib.responses[self.response_map['UNPROCESSABLE']])
         body = self.fixtures.load('_v2_domains_testdomain_records_CREATE.json')
         return (self.response_map[self.type], body, {},
@@ -174,7 +174,7 @@ class DigitalOceanDNSMockHttp(MockHttp):
             self, method, url, body, headers):
         if body is None:
             body = self.fixtures.load('_v2_domains_UNPROCESSABLE_ENTITY.json')
-            return (self.response_map[self.type], body, {},
+            return (self.response_map['UNPROCESSABLE'], body, {},
                     httplib.responses[self.response_map['UNPROCESSABLE']])
         body = self.fixtures.load(
             '_v2_domains_testdomain_records_1234564_UPDATE.json')


[libcloud] 04/05: Add changelog entry.

Posted by to...@apache.org.
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 cda0233a9d1fc35fdee346d2dbc6a9bb1e344a5a
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Thu Nov 5 23:14:30 2020 +0100

    Add changelog entry.
---
 CHANGES.rst | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/CHANGES.rst b/CHANGES.rst
index f2339ec..aacb5fe 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -96,6 +96,12 @@ DNS
   (GITHUB-1512, GITHUB-1513)
   [Will Hughes - @insertjokehere]
 
+- [DigitalOcean] Update driver and make sure request data is sent as part of
+  HTTP request body on POST and PUT operations (previously it was sent as
+  part of query params).
+  (GITHUB-1505)
+  [Andrew Starr-Bochicchio - @andrewsomething]
+
 Changes in Apache Libcloud 3.2.0
 --------------------------------
 


[libcloud] 01/05: dns/digitalocean: send attributes in body for PUT and POST operations.

Posted by to...@apache.org.
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 4c0daed271645bc8a12438ddeb89faa33ff09418
Author: Andrew Starr-Bochicchio <a....@gmail.com>
AuthorDate: Wed Oct 14 11:42:51 2020 -0400

    dns/digitalocean: send attributes in body for PUT and POST operations.
---
 libcloud/dns/drivers/digitalocean.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libcloud/dns/drivers/digitalocean.py b/libcloud/dns/drivers/digitalocean.py
index ef24b94..e393b05 100644
--- a/libcloud/dns/drivers/digitalocean.py
+++ b/libcloud/dns/drivers/digitalocean.py
@@ -20,6 +20,8 @@ __all__ = [
     'DigitalOceanDNSDriver'
 ]
 
+import json
+
 from libcloud.utils.py3 import httplib
 
 from libcloud.common.digitalocean import DigitalOcean_v2_BaseDriver
@@ -128,7 +130,7 @@ class DigitalOceanDNSDriver(DigitalOcean_v2_BaseDriver, DNSDriver):
         except Exception:
             params['ip_address'] = '127.0.0.1'
 
-        res = self.connection.request('/v2/domains', params=params,
+        res = self.connection.request('/v2/domains', data=json.dumps(params),
                                       method='POST')
 
         return Zone(id=res.object['domain']['name'],
@@ -183,7 +185,7 @@ class DigitalOceanDNSDriver(DigitalOcean_v2_BaseDriver, DNSDriver):
                 params['ttl'] = extra['ttl']
 
         res = self.connection.request('/v2/domains/%s/records' % zone.id,
-                                      params=params,
+                                      data=json.dumps(params),
                                       method='POST')
 
         return Record(id=res.object['domain_record']['id'],
@@ -243,7 +245,7 @@ class DigitalOceanDNSDriver(DigitalOcean_v2_BaseDriver, DNSDriver):
 
         res = self.connection.request('/v2/domains/%s/records/%s' %
                                       (record.zone.id, record.id),
-                                      params=params,
+                                      data=json.dumps(params),
                                       method='PUT')
 
         return Record(id=res.object['domain_record']['id'],