mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2026-11-03 04:40:31 -06:00
dnspython: Add compatibility shim
`dnspython` 2.0.0 has many changes and several deprecations like: ``` > dns.resolver.resolve() has been added, allowing control of whether search lists are used. dns.resolver.query() is retained for backwards compatibility, but deprecated. The default for search list behavior can be set at in the resolver object with the use_search_by_default parameter. The default is False. > dns.resolver.resolve_address() has been added, allowing easy address-to-name lookups. ``` The new class `DNSResolver`: - provides the compatibility layer - defaults the previous behavior (the search list configured in the system's resolver configuration is used for relative names) - defaults lifetime to 15sec (determines the number of seconds to spend trying to get an answer to the question) Fixes: https://pagure.io/freeipa/issue/8383 Signed-off-by: Stanislav Levin <slev@altlinux.org> Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
1 parent
fdb227e55a
commit
49e643783d
16 files changed
+158
-86
No files matched your search
@@ -38,7 +38,7 @@ from contextlib import contextmanager
|
||||
from configparser import ConfigParser as SafeConfigParser
|
||||
from configparser import NoOptionError
|
||||
|
||||
from dns import resolver, rdatatype
|
||||
from dns import rdatatype
|
||||
from dns.exception import DNSException
|
||||
import ldap
|
||||
import six
|
||||
@@ -53,6 +53,7 @@ from ipalib.constants import MAXHOSTNAMELEN
|
||||
from ipalib.util import validate_hostname
|
||||
from ipalib import api, errors, x509
|
||||
from ipapython.dn import DN
|
||||
from ipapython.dnsutil import resolve, get_ipa_resolver
|
||||
from ipaserver.install import certs, service, sysupgrade
|
||||
from ipaplatform import services
|
||||
from ipaplatform.paths import paths
|
||||
@@ -187,7 +188,7 @@ def verify_fqdn(host_name, no_host_dns=False, local_hostname=True):
|
||||
# Verify this is NOT a CNAME
|
||||
try:
|
||||
logger.debug('Check if %s is not a CNAME', host_name)
|
||||
resolver.query(host_name, rdatatype.CNAME)
|
||||
resolve(host_name, rdatatype.CNAME)
|
||||
raise HostReverseLookupError("The IPA Server Hostname cannot be a CNAME, only A and AAAA names are allowed.")
|
||||
except DNSException:
|
||||
pass
|
||||
@@ -284,11 +285,13 @@ def read_ip_addresses():
|
||||
def read_dns_forwarders():
|
||||
addrs = []
|
||||
if ipautil.user_input("Do you want to configure DNS forwarders?", True):
|
||||
print("Following DNS servers are configured in /etc/resolv.conf: %s" %
|
||||
", ".join(resolver.get_default_resolver().nameservers))
|
||||
print(
|
||||
"Following DNS servers are configured in /etc/resolv.conf: %s"
|
||||
% ", ".join(get_ipa_resolver().nameservers)
|
||||
)
|
||||
if ipautil.user_input("Do you want to configure these servers as DNS "
|
||||
"forwarders?", True):
|
||||
addrs = resolver.default_resolver.nameservers[:]
|
||||
addrs = get_ipa_resolver().nameservers[:]
|
||||
print("All DNS servers from /etc/resolv.conf were added. You can "
|
||||
"enter additional addresses now:")
|
||||
while True:
|
||||
|
||||
Reference in new issue
Block a user