summaryrefslogtreecommitdiffstats
path: root/install/tools/ipa-replica-prepare
diff options
context:
space:
mode:
authorMartin Kosek <mkosek@redhat.com>2011-10-06 11:26:03 +0200
committerMartin Kosek <mkosek@redhat.com>2011-10-06 11:27:50 +0200
commit5b968f96328a3044c89d2499b91aa38aa9cf0c80 (patch)
treea2fcc92a9a1e8065a6085ca065b93eb3ed8119df /install/tools/ipa-replica-prepare
parent652d315b3e486abb0b51e02437cd0f1243425a6e (diff)
downloadfreeipa-5b968f96328a3044c89d2499b91aa38aa9cf0c80.tar.gz
freeipa-5b968f96328a3044c89d2499b91aa38aa9cf0c80.tar.xz
freeipa-5b968f96328a3044c89d2499b91aa38aa9cf0c80.zip
Improve ipa-replica-prepare DNS check
Currently, verify_fqdn() function raises RuntimeError for every problem with the hostname. This makes it difficult for tools like ipa-replica-prepare to behave differently for a subset of raised errors (for example to be able to create a DNS record for new replica when verify_fqdn() reports a lookup error). Implement own exceptions for verify_fqdn() that they can be safely used to distinguish the error type. https://fedorahosted.org/freeipa/ticket/1899
Diffstat (limited to 'install/tools/ipa-replica-prepare')
-rwxr-xr-xinstall/tools/ipa-replica-prepare6
1 files changed, 3 insertions, 3 deletions
diff --git a/install/tools/ipa-replica-prepare b/install/tools/ipa-replica-prepare
index 6e98a2d0a..924fd9b5f 100755
--- a/install/tools/ipa-replica-prepare
+++ b/install/tools/ipa-replica-prepare
@@ -29,7 +29,7 @@ from ipapython import ipautil
from ipaserver.install import bindinstance, dsinstance, installutils, certs
from ipaserver.install.bindinstance import add_zone, add_reverse_zone, add_fwd_rr, add_ptr_rr, dns_container_exists
from ipaserver.install.replication import enable_replication_version_checking
-from ipaserver.install.installutils import resolve_host
+from ipaserver.install.installutils import resolve_host, BadHostError, HostLookupError
from ipaserver.plugins.ldap2 import ldap2
from ipapython import version
from ipapython.config import IPAOptionParser
@@ -268,9 +268,9 @@ def main():
try:
installutils.verify_fqdn(replica_fqdn, system_name_check=False)
- except RuntimeError, e:
+ except BadHostError, e:
msg = str(e)
- if msg.startswith('Unable to resolve host name'):
+ if isinstance(e, HostLookupError):
if options.ip_address is None:
if dns_container_exists(api.env.host, api.env.basedn,
dm_password=dirman_password,