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
This commit is contained in:
Martin Kosek
2011-10-06 11:26:03 +02:00
parent 652d315b3e
commit 5b968f9632
5 changed files with 40 additions and 30 deletions

View File

@@ -30,7 +30,7 @@ from ipaserver.install import installutils, service
from ipaserver.install import certs
from ipaserver.install.installutils import HostnameLocalhost
from ipaserver.install.installutils import ReplicaConfig, expand_replica_info, read_replica_info
from ipaserver.install.installutils import get_host_name
from ipaserver.install.installutils import get_host_name, BadHostError
from ipaserver.install import dsinstance, cainstance
from ipaserver.install.replication import replica_conn_check
from ipapython import version
@@ -119,7 +119,7 @@ def main():
config.dirman_password = dirman_password
try:
host = get_host_name(options.no_host_dns)
except RuntimeError, e:
except BadHostError, e:
logging.error(str(e))
sys.exit(1)
if config.host_name != host: