Move function is_auto_empty_zone() into ipapython.dnsutil

I'm going to extend this so it is better to have it in module.
At the same time it is now using shared assert_absolute_dnsname()
helper.

https://fedorahosted.org/freeipa/ticket/5710

Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
Petr Spacek 2016-03-07 13:30:35 +01:00 committed by Petr Vobornik
parent 41464b74f4
commit 6752d6404a
2 changed files with 7 additions and 7 deletions

View File

@ -185,3 +185,9 @@ def assert_absolute_dnsname(name):
assert isinstance(name, DNSName), ("name must be DNSName instance, " assert isinstance(name, DNSName), ("name must be DNSName instance, "
"got '%s'" % type(name)) "got '%s'" % type(name))
assert name.is_absolute(), "name must be absolute, got '%s'" % name assert name.is_absolute(), "name must be absolute, got '%s'" % name
def is_auto_empty_zone(zone):
"""True if specified zone name exactly matches an automatic empty zone."""
assert isinstance(zone, DNSName)
return zone in EMPTY_ZONES

View File

@ -52,7 +52,7 @@ from ipapython.ipa_log_manager import root_logger
from ipapython import config from ipapython import config
from ipaplatform.paths import paths from ipaplatform.paths import paths
from ipapython.dn import DN from ipapython.dn import DN
from ipapython.dnsutil import DNSName, EMPTY_ZONES from ipapython.dnsutil import DNSName, is_auto_empty_zone
SHARE_DIR = paths.USR_SHARE_IPA_DIR SHARE_DIR = paths.USR_SHARE_IPA_DIR
PLUGINS_SHARE_DIR = paths.IPA_PLUGINS PLUGINS_SHARE_DIR = paths.IPA_PLUGINS
@ -1065,12 +1065,6 @@ def check_zone_overlap(zone, raise_on_error=True):
raise ValueError(msg) raise ValueError(msg)
def is_auto_empty_zone(zone):
"""True if specified zone name exactly matches an automatic empty zone."""
assert isinstance(zone, DNSName)
return zone in EMPTY_ZONES
def config_replace_variables(filepath, replacevars=dict(), appendvars=dict()): def config_replace_variables(filepath, replacevars=dict(), appendvars=dict()):
""" """
Take a key=value based configuration file, and write new version Take a key=value based configuration file, and write new version