mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
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:
@@ -388,15 +388,10 @@ def read_host_name(host_default,no_host_dns=False):
|
||||
print ""
|
||||
if host_default == "":
|
||||
host_default = "master.example.com"
|
||||
while True:
|
||||
host_name = user_input("Server host name", host_default, allow_empty = False)
|
||||
print ""
|
||||
try:
|
||||
verify_fqdn(host_name,no_host_dns)
|
||||
except Exception, e:
|
||||
raise e
|
||||
else:
|
||||
break
|
||||
host_name = user_input("Server host name", host_default, allow_empty = False)
|
||||
print ""
|
||||
verify_fqdn(host_name,no_host_dns)
|
||||
|
||||
return host_name
|
||||
|
||||
def read_domain_name(domain_name, unattended):
|
||||
@@ -750,7 +745,7 @@ def main():
|
||||
host_name = host_default
|
||||
else:
|
||||
host_name = read_host_name(host_default,options.no_host_dns)
|
||||
except RuntimeError, e:
|
||||
except BadHostError, e:
|
||||
sys.exit(str(e) + "\n")
|
||||
|
||||
host_name = host_name.lower()
|
||||
|
||||
Reference in New Issue
Block a user