ipa-client-install: warn when IP used in --server

ipa-client-install fails when an IP address is passed
to ipa-join instead of a FQDN

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

Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
Stanislav Laznicka
2015-08-11 10:10:48 +02:00
committed by Martin Basti
parent e4dff25838
commit 592e437fc7

View File

@@ -2305,6 +2305,25 @@ def install(options, env, fstore, statestore):
root_logger.info("BaseDN: %s", cli_basedn)
root_logger.debug("BaseDN source: %s", cli_basedn_source)
# ipa-join would fail with IP address instead of a FQDN
for srv in cli_server:
try:
socket.inet_pton(socket.AF_INET, srv)
is_ipaddr = True
except:
try:
socket.inet_pton(socket.AF_INET6, srv)
is_ipaddr = True
except:
is_ipaddr = False
if is_ipaddr:
print
root_logger.warning("It seems that you are using an IP address "
"instead of FQDN as an argument to --server. The "
"installation may fail.")
break
print
if not options.unattended and not user_input("Continue to configure the system with these values?", False):
return CLIENT_INSTALL_ERROR