From 915235859cb67d4f350ff506b435586fd15505e7 Mon Sep 17 00:00:00 2001 From: Martin Kosek Date: Tue, 31 May 2011 12:51:38 +0200 Subject: IPA installation with --no-host-dns fails --no-host-dns option should allow installing IPA server on a host without a DNS resolvable name. Update parse_ip_address and verify_ip_address functions has been changed not to return None and print error messages in case of an error, but rather let the Exception be handled by the calling routine. https://fedorahosted.org/freeipa/ticket/1246 --- install/tools/ipa-dns-install | 9 ++++++++- install/tools/ipa-replica-prepare | 5 ----- install/tools/ipa-server-install | 21 +++++++++++++++------ 3 files changed, 23 insertions(+), 12 deletions(-) (limited to 'install') diff --git a/install/tools/ipa-dns-install b/install/tools/ipa-dns-install index 91edcca8a..39998ac47 100755 --- a/install/tools/ipa-dns-install +++ b/install/tools/ipa-dns-install @@ -108,7 +108,14 @@ def main(): else: hostaddr = resolve_host(api.env.host) ip_address = hostaddr and ipautil.CheckedIPAddress(hostaddr) - if not ip_address or not verify_ip_address(ip_address): + + try: + verify_ip_address(ip_address) + except Exception, e: + print "Error: Invalid IP Address %s: %s" % (ip_address, e) + ip_address = None + + if not ip_address: if options.unattended: sys.exit("Unable to resolve IP address for host name") else: diff --git a/install/tools/ipa-replica-prepare b/install/tools/ipa-replica-prepare index df44934de..cd13f5d93 100755 --- a/install/tools/ipa-replica-prepare +++ b/install/tools/ipa-replica-prepare @@ -78,11 +78,6 @@ def parse_options(): if cnt > 0 and cnt < num: parser.error("All PKCS#12 options are required if any are used.") - if options.ip_address: - if not installutils.verify_ip_address(options.ip_address, match_local=False): - parser.error("Bad IP address") - sys.exit(1) - if len(args) != 1: parser.error("must provide the fully-qualified name of the replica") diff --git a/install/tools/ipa-server-install b/install/tools/ipa-server-install index a62aa150a..18319bed9 100755 --- a/install/tools/ipa-server-install +++ b/install/tools/ipa-server-install @@ -598,14 +598,20 @@ def main(): if hostaddr is not None: ip = CheckedIPAddress(hostaddr) else: + if not options.ip_address: + print "Unable to resolve IP address for host name" ip = options.ip_address if ip is None and options.unattended: sys.exit("Unable to resolve IP address for host name") - if not verify_ip_address(ip): - ip = None - if options.unattended: - sys.exit(1) + if ip: + try: + verify_ip_address(ip) + except Exception, e: + print "Error: Invalid IP Address %s: %s" % (ip, e) + if options.unattended: + sys.exit(1) + ip = None if options.ip_address: if options.ip_address != ip and not options.setup_dns: @@ -615,8 +621,11 @@ def main(): return 1 ip = options.ip_address - if not verify_ip_address(ip): - return 1 + try: + verify_ip_address(ip) + except Exception, e: + print "Error: Invalid IP Address %s: %s" % (ip, e) + sys.exit(1) if ip is None: ip = read_ip_address(host_name, fstore) -- cgit