When an IPA server with unresolvable hostname is being installed,
a hostname record must be inserted to /etc/hosts or the
installation will fail. However, it is not inserted when IP
address is passed as an option (--ip-address) and not
interactively. This patch fixes this so that /etc/hosts
record is inserted in both cases.

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

>From 52b097218c4c031c4a91557611e31dd1da921911 Mon Sep 17 00:00:00 2001
From: Martin Kosek <mko...@redhat.com>
Date: Mon, 7 Nov 2011 18:35:23 +0100
Subject: [PATCH] Hosts file not updated when IP is passed as option

When an IPA server with unresolvable hostname is being installed,
a hostname record must be inserted to /etc/hosts or the
installation will fail. However, it is not inserted when IP
address is passed as an option (--ip-address) and not
interactively. This patch fixes this so that /etc/hosts
record is inserted in both cases.

https://fedorahosted.org/freeipa/ticket/2074
---
 install/tools/ipa-server-install |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/install/tools/ipa-server-install b/install/tools/ipa-server-install
index 1dbeef59620ff135efd68fb47fef740015b62639..4c56b66172fb41d2c0372022b6608a118083e116 100755
--- a/install/tools/ipa-server-install
+++ b/install/tools/ipa-server-install
@@ -754,10 +754,14 @@ def main():
 
     # Check we have a public IP that is associated with the hostname
     hostaddr = resolve_host(host_name)
+    ip_add_to_hosts = False
     if hostaddr is not None:
         ip = CheckedIPAddress(hostaddr, match_local=True)
     else:
+        # hostname is not resolvable
         ip = options.ip_address
+        ip_add_to_hosts = True
+
     if ip is None:
         print "Unable to resolve IP address for host name"
         if options.unattended:
@@ -772,11 +776,9 @@ def main():
 
         ip = options.ip_address
 
-    ip_add_to_hosts = False
     if ip is None:
         ip = read_ip_address(host_name, fstore)
         logging.debug("read ip_address: %s\n" % str(ip))
-        ip_add_to_hosts = True
 
     ip_address = str(ip)
 
-- 
1.7.6.4

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to