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/01 20:54:42 UTC

[libcloud] 03/06: To be on the safe side, only include data attribute on record create and update if it's not empty.

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 54276d3857a4e64c11bacd52bc4f48acdecc35b0
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Sun Nov 1 21:35:44 2020 +0100

    To be on the safe side, only include data attribute on record create
    and update if it's not empty.
    
    This way data will only be provided for SSHFP records.
---
 libcloud/dns/drivers/cloudflare.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/libcloud/dns/drivers/cloudflare.py b/libcloud/dns/drivers/cloudflare.py
index 62dcbf4..31de7e7 100644
--- a/libcloud/dns/drivers/cloudflare.py
+++ b/libcloud/dns/drivers/cloudflare.py
@@ -329,10 +329,12 @@ class CloudFlareDNSDriver(DNSDriver):
         body = {
             'type': type,
             'name': name,
-            'content': content,
-            'data': data
+            'content': content
         }
 
+        if data:
+            body['data'] = data
+
         merge_valid_keys(body, RECORD_CREATE_ATTRIBUTES, extra)
 
         self.connection.set_context({'zone_id': zone.id})
@@ -362,10 +364,12 @@ class CloudFlareDNSDriver(DNSDriver):
             'type': record.type if type is None else type,
             'name': record.name if name is None else name,
             'content': content,
-            'data': data,
             'extra': record.extra or {},
         }
 
+        if data:
+            body['data'] = data
+
         merge_valid_keys(body['extra'], RECORD_UPDATE_ATTRIBUTES, extra)
 
         self.connection.set_context({'record_id': record.id})