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 b167b4d71b4131dddbcc58ad406d90a0d8180faf
Author: Dave Grenier <[email protected]>
AuthorDate: Thu Apr 28 17:17:02 2022 -0400

    Add expires condition
    
    Adding expires condition for when API does not return a expires item
---
 libcloud/dns/drivers/godaddy.py | 29 +++++++++++++++++++----------
 1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/libcloud/dns/drivers/godaddy.py b/libcloud/dns/drivers/godaddy.py
index f33aa5877..d0e3b02bf 100644
--- a/libcloud/dns/drivers/godaddy.py
+++ b/libcloud/dns/drivers/godaddy.py
@@ -445,17 +445,26 @@ class GoDaddyDNSDriver(DNSDriver):
         return zones
 
     def _to_zone(self, item):
-        extra = {"expires": item["expires"]}
-        zone = Zone(
-            id=item["domainId"],
-            domain=item["domain"],
-            type="master",
-            ttl=None,
-            driver=self,
-            extra=extra,
-        )
+        if "expires" not in item:
+          zone = Zone(
+              id=item["domainId"],
+              domain=item["domain"],
+              type="master",
+              ttl=None,
+              driver=self,
+          )
+        if "expires" in item:
+          extra = {"expires": item["expires"]}
+          zone = Zone(
+              id=item["domainId"],
+              domain=item["domain"],
+              type="master",
+              ttl=None,
+              driver=self,
+              extra=extra,
+          )
         return zone
-
+    
     def _to_records(self, items, zone=None):
         records = []
 

Reply via email to