Closed ross closed 1 year ago
Interesting.
If you do this below and see if it resolves.
>>> import dns.resolver
>>> dns.resolver.resolve('localhost')[0].address
'127.0.0.1'
>>> import dns.resolver
>>> dns.resolver.resolve('localhost')[0].address
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/ross/octodns/octodns-bind/env/lib/python3.10/site-packages/dns/resolver.py", line 1368, in resolve
return get_default_resolver().resolve(
File "/Users/ross/octodns/octodns-bind/env/lib/python3.10/site-packages/dns/resolver.py", line 1190, in resolve
(request, answer) = resolution.next_request()
File "/Users/ross/octodns/octodns-bind/env/lib/python3.10/site-packages/dns/resolver.py", line 691, in next_request
raise NXDOMAIN(qnames=self.qnames_to_try, responses=self.nxdomain_responses)
dns.resolver.NXDOMAIN: The DNS query name does not exist: localhost.
Fix over in https://github.com/octodns/octodns-bind/pull/25
Oh this probably happens because dns.resolver
does actually query a resolver immediately and doesn't go through the normal chain of things (host file, etc.) before making it. So in some cases you have like systemd-resolved
dealing with that or whatever resolver may be running locally on the machine and then going to a real resolver, but if your resolver is 1.1.1.1 or something and it queries it, you won't get anything.
Interesting, may need to change that so it does the actual looking into host file, etc or just handle the localhost -> 127.0.0.1
in the code (which I don't love). Probably need to use socket.gethostbyname
While looking into a test failure related to https://github.com/octodns/octodns/pull/1004 I pulled the lasted code and tried to run tests, but got a failure to resolve
localhost
?Guessing this is related to https://github.com/octodns/octodns-bind/pull/22 and
localhost
isn't resolving when looked up on my computer/network. My first thought is to change the name there to an IP address...