diff options
author | Petr Spacek <pspacek@redhat.com> | 2016-05-17 17:06:32 +0200 |
---|---|---|
committer | Martin Basti <mbasti@redhat.com> | 2016-05-30 20:14:32 +0200 |
commit | 0c75df4bf3784eae08f41c176bbaab44c6d510a7 (patch) | |
tree | 2b7c1162a64f95c62e6f8cc642dbb51007cc404c /ipapython/ipautil.py | |
parent | da71e7e9de233bc0e40a90adb2db6d0944a1356a (diff) | |
download | freeipa-0c75df4bf3784eae08f41c176bbaab44c6d510a7.tar.gz freeipa-0c75df4bf3784eae08f41c176bbaab44c6d510a7.tar.xz freeipa-0c75df4bf3784eae08f41c176bbaab44c6d510a7.zip |
Move check_zone_overlap() from ipapython.ipautil to ipapython.dnsutil
This is preparatory work to avoid (future) cyclic import between
ipapython.dnsutil and ipapython.ipautil.
https://fedorahosted.org/freeipa/ticket/5710
Reviewed-By: Martin Basti <mbasti@redhat.com>
Diffstat (limited to 'ipapython/ipautil.py')
-rw-r--r-- | ipapython/ipautil.py | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/ipapython/ipautil.py b/ipapython/ipautil.py index d4c8e8b82..34e05d366 100644 --- a/ipapython/ipautil.py +++ b/ipapython/ipautil.py @@ -53,7 +53,6 @@ from ipapython.ipa_log_manager import root_logger from ipapython import config from ipaplatform.paths import paths from ipapython.dn import DN -from ipapython.dnsutil import DNSName, is_auto_empty_zone SHARE_DIR = paths.USR_SHARE_IPA_DIR PLUGINS_SHARE_DIR = paths.IPA_PLUGINS @@ -1018,40 +1017,6 @@ def reverse_record_exists(ip_address): return True -def check_zone_overlap(zone, raise_on_error=True): - root_logger.info("Checking DNS domain %s, please wait ..." % zone) - if not isinstance(zone, DNSName): - zone = DNSName(zone).make_absolute() - - # automatic empty zones always exist so checking them is pointless, - # do not report them to avoid meaningless error messages - if is_auto_empty_zone(zone): - return - - try: - containing_zone = resolver.zone_for_name(zone) - except DNSException as e: - msg = ("DNS check for domain %s failed: %s." % (zone, e)) - if raise_on_error: - raise ValueError(msg) - else: - root_logger.warning(msg) - return - - if containing_zone == zone: - try: - ns = [ans.to_text() for ans in resolver.query(zone, 'NS')] - except DNSException as e: - root_logger.debug("Failed to resolve nameserver(s) for domain" - " {0}: {1}".format(zone, e)) - ns = [] - - msg = u"DNS zone {0} already exists in DNS".format(zone) - if ns: - msg += u" and is handled by server(s): {0}".format(', '.join(ns)) - raise ValueError(msg) - - def config_replace_variables(filepath, replacevars=dict(), appendvars=dict()): """ Take a key=value based configuration file, and write new version |