You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an NXDOMAIN is raised in dns.resolver.Resolver.query() the implementor should still have access to the partial result, specifically to find out a dangling CNAME. This is useful for example when chasing the right PTR record to update for a given IP Address (FreeIPA #5033). I propose to construct an Anwer object also for NXDOMAIN exceptions:
--- dns/resolver.py.2 2015-05-26 14:12:13.658045246 +0200
+++ dns/resolver.py 2015-05-26 15:31:26.459862822 +0200
@@ -44,7 +44,8 @@
import _winreg
class NXDOMAIN(dns.exception.DNSException):
- """The query name does not exist."""
+ """The query name does not exist.
+ The Exception argument is the partial answer."""
pass
class YXDOMAIN(dns.exception.DNSException):
@@ -907,7 +908,9 @@
all_nxdomain = False
break
if all_nxdomain:
- raise NXDOMAIN
+ answer = Answer(qnames_to_try[0], rdtype, rdclass,
+ response, False)
+ raise NXDOMAIN(answer)
answer = Answer(qname, rdtype, rdclass, response,
raise_on_no_answer)
if self.cache:
The text was updated successfully, but these errors were encountered:
cluck
changed the title
Pass partial result to NXRESULT exception
Pass partial answer to NXRESULT exception
May 26, 2015
cluck
changed the title
Pass partial answer to NXRESULT exception
Pass partial answer to NXDOMAIN exception
May 26, 2015
I generally like the idea but it needs to be polished.
@cluck , beware - the answer might really surprise you if search list in resolv.conf is non-empty. This needs to be carefully tested and documented because search lists make it quite complicated.
Another thing is that raise NXDOMAIN() should use a keyword argument to pass answer to it, please see class NXDOMAIN definition in resolver.py.
When an NXDOMAIN is raised in dns.resolver.Resolver.query() the implementor should still have access to the partial result, specifically to find out a dangling CNAME. This is useful for example when chasing the right PTR record to update for a given IP Address (FreeIPA #5033). I propose to construct an Anwer object also for NXDOMAIN exceptions:
The text was updated successfully, but these errors were encountered: