From d53df67c953143b65dc619b59656158cb55185fc Mon Sep 17 00:00:00 2001 From: Martin Nagy Date: Mon, 23 Nov 2009 09:15:35 +0100 Subject: Move some functions from ipa-server-install into installutils We will need these functions in the new upcoming ipa-dns-install command. --- install/tools/ipa-server-install | 55 +--------------------------------------- 1 file changed, 1 insertion(+), 54 deletions(-) (limited to 'install') diff --git a/install/tools/ipa-server-install b/install/tools/ipa-server-install index 94c385032..43095a499 100755 --- a/install/tools/ipa-server-install +++ b/install/tools/ipa-server-install @@ -268,59 +268,6 @@ def resolve_host(host_name): print "Unable to lookup the IP address of the provided host" return ip -def verify_ip_address(ip): - is_ok = True - try: - socket.inet_pton(socket.AF_INET, ip) - except: - try: - socket.inet_pton(socket.AF_INET6, ip) - except: - print "Unable to verify IP address" - is_ok = False - return is_ok - -def read_ip_address(host_name): - while True: - ip = user_input("Please provide the IP address to be used for this host name", allow_empty = False) - - if ip == "127.0.0.1" or ip == "::1": - print "The IPA Server can't use localhost as a valid IP" - continue - - if not verify_ip_address(ip): - continue - - print "Adding ["+ip+" "+host_name+"] to your /etc/hosts file" - fstore.backup_file("/etc/hosts") - hosts_fd = open('/etc/hosts', 'r+') - hosts_fd.seek(0, 2) - hosts_fd.write(ip+'\t'+host_name+' '+host_name.split('.')[0]+'\n') - hosts_fd.close() - - return ip - -def read_dns_forwarders(): - addrs = [] - while True: - ip = user_input("Enter IP address for a DNS forwarder (empty to stop)", allow_empty=True) - - if not ip: - break - if ip == "127.0.0.1" or ip == "::1": - print "You cannot use localhost as a DNS forwarder" - continue - if not verify_ip_address(ip): - continue - - print "DNS forwarder %s added" % ip - addrs.append(ip) - - if not addrs: - print "No DNS forwarders configured" - - return addrs - def read_ds_user(): print "The server must run as a specific user in a specific group." print "It is strongly recommended that this user should have no privileges" @@ -630,7 +577,7 @@ def main(): return 1 if not ip: - ip = read_ip_address(host_name) + ip = read_ip_address(host_name, fstore) ip_address = ip print "The IPA Master Server will be configured with" -- cgit