From 8edd7ed99874f114ec6ca6abbbdd4b91025211df Mon Sep 17 00:00:00 2001 From: Jan Cholasta Date: Tue, 26 Jul 2011 14:53:19 +0200 Subject: Ask for reverse DNS zone information in attended install right after asking for DNS forwarders, so that DNS configuration is done in one place. ticket 1522 --- install/tools/ipa-dns-install | 46 ++++++++++++++++++++-------------------- install/tools/ipa-server-install | 21 +++++++++--------- 2 files changed, 33 insertions(+), 34 deletions(-) diff --git a/install/tools/ipa-dns-install b/install/tools/ipa-dns-install index da70c85d8..cf400dd75 100755 --- a/install/tools/ipa-dns-install +++ b/install/tools/ipa-dns-install @@ -107,6 +107,21 @@ def main(): if bindinstance.named_conf_exists(): sys.exit("\nDNS is already configured in this IPA server.") + # Create a BIND instance + if options.unattended and not options.dm_password: + sys.exit("\nIn unattended mode you need to provide at least the -p option") + + dm_password = options.dm_password or read_password("Directory Manager", + confirm=False, validate=False) + bind = bindinstance.BindInstance(fstore, dm_password) + + # try the connection + try: + bind.ldap_connect() + bind.ldap_disconnect() + except ldap.INVALID_CREDENTIALS, e: + sys.exit("Password is not valid!") + # Check we have a public IP that is associated with the hostname if options.ip_address: ip = options.ip_address @@ -137,29 +152,6 @@ def main(): dns_forwarders = read_dns_forwarders() logging.debug("will use dns_forwarders: %s\n", str(dns_forwarders)) - conf_ntp = ntpinstance.NTPInstance(fstore).is_enabled() - - if not options.unattended: - print "" - print "The following operations may take some minutes to complete." - print "Please wait until the prompt is returned." - print "" - - # Create a BIND instance - if options.unattended and not options.dm_password: - sys.exit("\nIn unattended mode you need to provide at least the -p option") - - dm_password = options.dm_password or read_password("Directory Manager", - confirm=False, validate=False) - bind = bindinstance.BindInstance(fstore, dm_password) - - # try the connection - try: - bind.ldap_connect() - bind.ldap_disconnect() - except ldap.INVALID_CREDENTIALS, e: - sys.exit("Password is not valid!") - if bind.dm_password: api.Backend.ldap2.connect(bind_dn="cn=Directory Manager", bind_pw=bind.dm_password) else: @@ -179,6 +171,14 @@ def main(): if reverse_zone is not None: print "Using reverse zone %s" % reverse_zone + conf_ntp = ntpinstance.NTPInstance(fstore).is_enabled() + + if not options.unattended: + print "" + print "The following operations may take some minutes to complete." + print "Please wait until the prompt is returned." + print "" + bind.setup(api.env.host, ip_address, api.env.realm, api.env.domain, dns_forwarders, conf_ntp, reverse_zone, zonemgr=options.zonemgr) bind.create_instance() diff --git a/install/tools/ipa-server-install b/install/tools/ipa-server-install index 98941efe0..3605b0393 100755 --- a/install/tools/ipa-server-install +++ b/install/tools/ipa-server-install @@ -711,6 +711,16 @@ def main(): dns_forwarders = options.forwarders else: dns_forwarders = read_dns_forwarders() + + if options.reverse_zone: + reverse_zone = bindinstance.normalize_zone(options.reverse_zone) + elif not options.no_reverse: + reverse_zone = bindinstance.get_reverse_zone_default(ip) + if not options.unattended and bindinstance.create_reverse(): + reverse_zone = bindinstance.read_reverse_zone(reverse_zone, ip) + + if reverse_zone is not None: + print "Using reverse zone %s" % reverse_zone else: dns_forwarders = () logging.debug("will use dns_forwarders: %s\n" % str(dns_forwarders)) @@ -919,17 +929,6 @@ def main(): # Create a BIND instance bind = bindinstance.BindInstance(fstore, dm_password) - if options.setup_dns: - if options.reverse_zone: - reverse_zone = bindinstance.normalize_zone(options.reverse_zone) - elif not options.no_reverse: - reverse_zone = bindinstance.get_reverse_zone_default(ip) - if not options.unattended and bindinstance.create_reverse(): - reverse_zone = bindinstance.read_reverse_zone(reverse_zone, ip) - - if reverse_zone is not None: - print "Using reverse zone %s" % reverse_zone - bind.setup(host_name, ip_address, realm_name, domain_name, dns_forwarders, options.conf_ntp, reverse_zone, zonemgr=options.zonemgr) if options.setup_dns: api.Backend.ldap2.connect(bind_dn="cn=Directory Manager", bind_pw=dm_password) -- cgit