summaryrefslogtreecommitdiffstats
path: root/install/tools/ipa-dns-install
diff options
context:
space:
mode:
authorMartin Kosek <mkosek@redhat.com>2012-01-20 08:30:40 +0100
committerRob Crittenden <rcritten@redhat.com>2012-01-22 23:01:42 -0500
commit6141919fba30487e3c4eb19b0c87a10384fd9d20 (patch)
tree945367b213fc59bde5aa5db8cc32a2703c36f508 /install/tools/ipa-dns-install
parentf7b4eb6a0918c0b73d4b98f47dcd76fa4e8072f5 (diff)
downloadfreeipa-6141919fba30487e3c4eb19b0c87a10384fd9d20.tar.gz
freeipa-6141919fba30487e3c4eb19b0c87a10384fd9d20.tar.xz
freeipa-6141919fba30487e3c4eb19b0c87a10384fd9d20.zip
Fix ipa-server-install for dual NICs
A server may have 2 or more NICs and its hostname may thus resolve to 2 and more forward addresses. IP address checks in install scripts does not expect this setup and may fail or crash. This script adds a support for multiple forward addresses for a hostname. The install scripts do not crash now. When one IP address is needed, user is asked to choose from all detected server IP addresses. https://fedorahosted.org/freeipa/ticket/2154
Diffstat (limited to 'install/tools/ipa-dns-install')
-rwxr-xr-xinstall/tools/ipa-dns-install21
1 files changed, 20 insertions, 1 deletions
diff --git a/install/tools/ipa-dns-install b/install/tools/ipa-dns-install
index 5c02c20c0..98929bdc3 100755
--- a/install/tools/ipa-dns-install
+++ b/install/tools/ipa-dns-install
@@ -147,7 +147,26 @@ def main():
else:
hostaddr = resolve_host(api.env.host)
try:
- ip = hostaddr and ipautil.CheckedIPAddress(hostaddr, match_local=True)
+ if len(hostaddr) > 1:
+ print >> sys.stderr, "The server hostname resolves to more than one address:"
+ for addr in hostaddr:
+ print >> sys.stderr, " %s" % addr
+
+ if options.ip_address:
+ if str(options.ip_address) not in hostaddr:
+ print >> sys.stderr, "Address passed in --ip-address did not match any resolved"
+ print >> sys.stderr, "address!"
+ sys.exit(1)
+ print "Selected IP address:", str(options.ip_address)
+ ip = options.ip_address
+ else:
+ if options.unattended:
+ print >> sys.stderr, "Please use --ip-address option to specify the address"
+ sys.exit(1)
+ else:
+ ip = read_ip_address(api.env.host, fstore)
+ else:
+ ip = hostaddr and ipautil.CheckedIPAddress(hostaddr[0], match_local=True)
except Exception, e:
print "Error: Invalid IP Address %s: %s" % (ip, e)
ip = None