libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [libcloud] Kami commented on a change in pull request #1328: powerdns driver adapted to work with pdns 3 and 4
Date Sat, 03 Aug 2019 15:18:38 GMT
Kami commented on a change in pull request #1328: powerdns driver adapted to work with pdns
3 and 4
URL: https://github.com/apache/libcloud/pull/1328#discussion_r310354651
 
 

 ##########
 File path: libcloud/dns/drivers/powerdns.py
 ##########
 @@ -439,13 +485,27 @@ def _to_zones(self, items):
             zones.append(self._to_zone(item))
         return zones
 
-    def _to_record(self, item, zone):
-        return Record(id=None, name=item['name'], data=item['content'],
+    def _to_record(self, item, zone, record = None):
+        if record is None:
+            data = item['content']
+        else:
+            data = record['content']
+        return Record(id=None, name=item['name'], data=data,
                       type=item['type'], zone=zone, driver=self,
                       ttl=item['ttl'])
 
     def _to_records(self, items, zone):
         records = []
-        for item in items.object['records']:
-            records.append(self._to_record(item, zone))
+        if self._pdns_version() == 3:
+            for item in items.object['records']:
+                records.append(self._to_record(item, zone))
+        if self._pdns_version() == 4:
+            for item in items.object['rrsets']:
+                for record in item['records']:
+                    records.append(self._to_record(item, zone, record))
         return records
+		
+    def _pdns_version(self):
+        if self.api_root == '': return 3
 
 Review comment:
   How is version currently declared? To which version does the driver currently default to?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message