catalyst / pdns-cli

Command line client for the PowerDNS HTTPS API
GNU General Public License v3.0
7 stars 5 forks source link

Use correct key to lookup rrsets in zone #4

Closed fkleon closed 4 years ago

fkleon commented 4 years ago

As per PowerDNS API docs The Resource Record Sets of a Zone are listed in the rrsets key of the zone object.

This client tries to source them from the records key. which fails with the following error:

$ ./pdns -c conf.toml show-rrsets example.nz.
Traceback (most recent call last):
  File "./pdns", line 243, in <module>
    pdns_client.run()
  File "./pdns", line 77, in run
    module.run()
  File "./commands/rrset.py", line 54, in run
    getattr(self, (self.args.action).replace('-', '_'))()
  File "./commands/rrset.py", line 61, in show_rrsets
    for rrset in sorted([rrset for rrset in zone.rrsets if rrset.name == zone.data['name']],
  File ./models.py", line 96, in rrsets
    return {RRset(**rrset) for rrset in self.data['records']}
KeyError: 'records'
catalystfd commented 4 years ago

This was changed in #3, not sure if this is a versioning issue between PowerDNS api versions? cc @kevinshortnh

catalystfd commented 4 years ago

The api doc definitely says the zone record key is rrset and the swagger api doc bears that out so im going to merge this for now.