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
This commit is contained in:
Jan Cholasta
2011-07-26 14:53:19 +02:00
committed by Martin Kosek
parent bc6e128426
commit 8edd7ed998
2 changed files with 33 additions and 34 deletions

View File

@@ -107,6 +107,21 @@ def main():
if bindinstance.named_conf_exists(): if bindinstance.named_conf_exists():
sys.exit("\nDNS is already configured in this IPA server.") 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 # Check we have a public IP that is associated with the hostname
if options.ip_address: if options.ip_address:
ip = options.ip_address ip = options.ip_address
@@ -137,29 +152,6 @@ def main():
dns_forwarders = read_dns_forwarders() dns_forwarders = read_dns_forwarders()
logging.debug("will use dns_forwarders: %s\n", str(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: if bind.dm_password:
api.Backend.ldap2.connect(bind_dn="cn=Directory Manager", bind_pw=bind.dm_password) api.Backend.ldap2.connect(bind_dn="cn=Directory Manager", bind_pw=bind.dm_password)
else: else:
@@ -179,6 +171,14 @@ def main():
if reverse_zone is not None: if reverse_zone is not None:
print "Using reverse zone %s" % reverse_zone 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.setup(api.env.host, ip_address, api.env.realm, api.env.domain, dns_forwarders, conf_ntp, reverse_zone, zonemgr=options.zonemgr)
bind.create_instance() bind.create_instance()

View File

@@ -711,6 +711,16 @@ def main():
dns_forwarders = options.forwarders dns_forwarders = options.forwarders
else: else:
dns_forwarders = read_dns_forwarders() 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: else:
dns_forwarders = () dns_forwarders = ()
logging.debug("will use dns_forwarders: %s\n" % str(dns_forwarders)) logging.debug("will use dns_forwarders: %s\n" % str(dns_forwarders))
@@ -919,17 +929,6 @@ def main():
# Create a BIND instance # Create a BIND instance
bind = bindinstance.BindInstance(fstore, dm_password) 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) bind.setup(host_name, ip_address, realm_name, domain_name, dns_forwarders, options.conf_ntp, reverse_zone, zonemgr=options.zonemgr)
if options.setup_dns: if options.setup_dns:
api.Backend.ldap2.connect(bind_dn="cn=Directory Manager", bind_pw=dm_password) api.Backend.ldap2.connect(bind_dn="cn=Directory Manager", bind_pw=dm_password)