Systems (e.g. sandboxes) may not have /etc/resolv.conf or this file may not contain any configured name servers. For example, It's usual setting for ALTLinux build farm.
/etc/resolv.conf
https://man7.org/linux/man-pages/man5/resolv.conf.5.html
If this file does not exist, only the name server on the local machine will be queried, and the search list contains the local domain name determined from the hostname. nameserver ... If no nameserver entries are present, the default is to use the name server on the local machine.
If this file does not exist, only the name server on the local machine will be queried, and the search list contains the local domain name determined from the hostname.
nameserver ... If no nameserver entries are present, the default is to use the name server on the local machine.
New TestDNSResolver unit tests introduced in IPA 4.9.11 fails on such system with:
TestDNSResolver
[builder@localhost freeipa-4.9.11]$ make fasttest ... ====================================== FAILURES ====================================== __________________________ TestDNSResolver.test_nameservers __________________________ self = <ipapython.dnsutil.DNSResolver object at 0x7f36389fc610> f = '/etc/resolv.conf' def read_resolv_conf(self, f): """Process *f* as a file in the /etc/resolv.conf format. If f is a ``str``, it is used as the name of the file to open; otherwise it is treated as the file itself. Interprets the following items: - nameserver - name server IP address - domain - local domain name - search - search list for host-name lookup - options - supported options are rotate, timeout, edns0, and ndots """ with contextlib.ExitStack() as stack: if isinstance(f, str): try: > f = stack.enter_context(open(f)) E FileNotFoundError: [Errno 2] No such file or directory: '/etc/resolv.conf' /usr/lib/python3/site-packages/dns/resolver.py:806: FileNotFoundError During handling of the above exception, another exception occurred: self = <ipatests.test_ipapython.test_dnsutil.TestDNSResolver object at 0x7f363e41a7a0> def test_nameservers(self): > res = dnsutil.DNSResolver() test_ipapython/test_dnsutil.py:108: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../ipapython/dnsutil.py:90: in __init__ super().__init__(*args, **kwargs) /usr/lib/python3/site-packages/dns/resolver.py:758: in __init__ self.read_resolv_conf(filename) ../ipapython/dnsutil.py:138: in read_resolv_conf super().read_resolv_conf(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <ipapython.dnsutil.DNSResolver object at 0x7f36389fc610> f = '/etc/resolv.conf' def read_resolv_conf(self, f): """Process *f* as a file in the /etc/resolv.conf format. If f is a ``str``, it is used as the name of the file to open; otherwise it is treated as the file itself. Interprets the following items: - nameserver - name server IP address - domain - local domain name - search - search list for host-name lookup - options - supported options are rotate, timeout, edns0, and ndots """ with contextlib.ExitStack() as stack: if isinstance(f, str): try: f = stack.enter_context(open(f)) except OSError: # /etc/resolv.conf doesn't exist, can't be read, etc. > raise NoResolverConfiguration(f'cannot open {f}') E dns.resolver.NoResolverConfiguration: cannot open /etc/resolv.conf /usr/lib/python3/site-packages/dns/resolver.py:809: NoResolverConfiguration ... FAILED test_ipapython/test_dnsutil.py::TestDNSResolver::test_nameservers - dns.resolver.NoResolverConfiguration: cannot open /etc/resolv.conf FAILED test_ipapython/test_dnsutil.py::TestDNSResolver::test_nameservers_with_ports - dns.resolver.NoResolverConfiguration: cannot open /etc/resolv.conf FAILED test_ipapython/test_dnsutil.py::TestDNSResolver::test_nameservers_with_bad_ports - dns.resolver.NoResolverConfiguration: cannot open /etc/resolv.conf
dnspython's Resolver fails to read /etc/resolv.conf or report missing name servers. Actually TestDNSResolver unit tests check only customizednameservers property (setter and getter) and should not depend on existence of /etc/resolv.conf.
dnspython
Resolver
nameservers
Resolver accepts configure option. https://dnspython.readthedocs.io/en/latest/resolver-class.html
configure
configure, a bool. If True (the default), the resolver instance is configured in the normal fashion for the operating system the resolver is running on. (I.e. by reading a /etc/resolv.conf file on POSIX systems and from the registry on Windows systems.)
Metadata Update from @slev: - Issue assigned to slev
pr: https://github.com/freeipa/freeipa/pull/6650
master:
ipa-4-9:
ipa-4-10:
Metadata Update from @frenaud: - Issue close_status updated to: fixed - Issue status updated to: Closed (was: Open)
Log in to comment on this ticket.