Description of problem: The following code: #!/usr/bin/python3 import sys import dns.resolver; try: print("AFSDB:") for AFSDB in dns.resolver.query(sys.argv[1], "AFSDB"): print("\t" + str(AFSDB.hostname)) except (dns.resolver.NXDOMAIN, dns.resolver.NoAnswer): print("Couldn't find any AFSDB records") when pointed at a place that produces a response with no pertinent answers, eg: /data/afs/dnstest.py your-file-system.com or: /data/afs/dnstest.py www.redhat.com tries to generate a NoAnswer exception, but incurs a KeyError exception whilst trying to do so and then yet another KeyError exception whilst trying to handle that: warthog>/data/afs/dnstest.py your-file-system.com AFSDB: Traceback (most recent call last): File "/usr/lib/python3.5/site-packages/dns/resolver.py", line 157, in __init__ rdclass, rdtype) File "/usr/lib/python3.5/site-packages/dns/message.py", line 333, in find_rrset raise KeyError KeyError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3.5/site-packages/dns/resolver.py", line 167, in __init__ dns.rdatatype.CNAME) File "/usr/lib/python3.5/site-packages/dns/message.py", line 333, in find_rrset raise KeyError KeyError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/data/afs/dnstest.py", line 6, in <module> for AFSDB in dns.resolver.query(sys.argv[1], "AFSDB"): File "/usr/lib/python3.5/site-packages/dns/resolver.py", line 1025, in query raise_on_no_answer, source_port) File "/usr/lib/python3.5/site-packages/dns/resolver.py", line 956, in query raise_on_no_answer) File "/usr/lib/python3.5/site-packages/dns/resolver.py", line 176, in __init__ raise NoAnswer(question=response.question) File "/usr/lib/python3.5/site-packages/dns/exception.py", line 47, in __init__ self._check_kwargs(**kwargs) File "/usr/lib/python3.5/site-packages/dns/exception.py", line 69, in _check_kwargs self.supp_kwargs) AssertionError: following set of keyword args is required: {'response'} On the other hand, invoking it with somewhere that has an AFSDB record works fine: warthog>/data/afs/dnstest.py grand.central.org AFSDB: grand-old-opry.central.org. grand.mit.edu. As does giving it an invalid name: warthog>/data/afs/dnstest.py grand.central.orgg AFSDB: Couldn't find any AFSDB records Version-Release number of selected component (if applicable): python3-3.5.1-17.fc24.x86_64 python3-dns-1.12.0GITa4774ee-1.fc24.noarch
Note that the problem still happens if AFSDB is changed to TXT in the code.
This looks like an upstream bug. I tried it with the current git snapshot. Interestingly, NoAnswer was handled correctly, but I was unable to get a response when there should have been one. I think this might be related to the deprecation of the ANY class, but I'm not sure. Can you confirm and file an issue upstream? [1] The plan is to update Fedora with 1.15.0 when it is released. [1] https://github.com/rthalley/dnspython/issues
I built the current git top into the Fedora RPM and it doesn't produce an AFSDB record, even for grand.central.org which definitely has one. However, examples/mx.py from the git tree crashes in the same way as I was seeing with my test program earlier if I make it use python3 but not if it uses python2.
This is fixed as of commit bb0c9f21f4a6f56f2fe8d7c1fc991080ef89d223 upstream.
Thanks for working with upstream. We're expecting 1.15.0 to be released in the near future and will put it out when it become available.
python-dns-1.15.0-1.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-4998c59ba3
python-dns-1.15.0-1.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-1857421df6
python-dns-1.15.0-1.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.
python-dns-1.15.0-1.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.