[Freeipa-devel] [PATCH 5 of 5] Fix host_name buglet in ipa-server-install

Mark McLoughlin markmc at redhat.com
Thu Oct 25 14:39:29 UTC 2007


# HG changeset patch
# User Mark McLoughlin <markmc at redhat.com>
# Date 1203607409 0
# Node ID 200657115003ef4405a84148cc75bd90a8ef34d1
# Parent  a976a68fd8d0b8b2b41af68e816a48c69b72a213
Fix host_name buglet in ipa-server-install

This patch fixes a couple of buglets with read_ip_address():

  1) It writes host_name to /etc/hosts, but isn't currently
     being passed host_name

  2) It doesn't return the IP address even though the caller
     expects it

Signed-off-by: Mark McLoughlin <markmc at redhat.com>

diff -r a976a68fd8d0 -r 200657115003 ipa-server/ipa-install/ipa-server-install
--- a/ipa-server/ipa-install/ipa-server-install	Thu Feb 21 15:23:29 2008 +0000
+++ b/ipa-server/ipa-install/ipa-server-install	Thu Feb 21 15:23:29 2008 +0000
@@ -228,9 +228,8 @@ def verify_ip_address(ip):
             is_ok = False
     return is_ok
 
-def read_ip_address():
-    askip = True
-    while askip:
+def read_ip_address(host_name):
+    while True:
         ip = raw_input("Please provide the IP address to be used for this host name: ")
 
         if ip == "":
@@ -247,7 +246,8 @@ def read_ip_address():
         hosts_fd.seek(0, 2)
         hosts_fd.write(ip+'\t'+host_name+' '+host_name[:host_name.find('.')]+'\n')
         hosts_fd.close()
-        askip = False
+
+        return ip
 
 def port_available(port):
     """Try to bind to a port on the wildcard host
@@ -461,7 +461,7 @@ def main():
             return "-Fatal Error-"
 
     if not ip:
-        ip = read_ip_address ()
+        ip = read_ip_address(host_name)
     ip_address = ip
 
     print "The IPA Master Server will be configured with"




More information about the Freeipa-devel mailing list