Create the reverse zone by default

A new option to specify reverse zone creation for unattended installs

https://fedorahosted.org/freeipa/ticket/678
This commit is contained in:
Jakub Hrozek
2011-01-04 08:55:47 -05:00
committed by Simo Sorce
parent 8a9fdbfb03
commit 9232a47877
4 changed files with 36 additions and 9 deletions

View File

@@ -42,6 +42,9 @@ def parse_options():
help="Add a DNS forwarder")
parser.add_option("--no-forwarders", dest="no_forwarders", action="store_true",
default=False, help="Do not add any DNS forwarders, use root servers instead")
parser.add_option("--no-reverse", dest="no_reverse",
action="store_true", default=False,
help="Do not create reverse DNS zone")
parser.add_option("--zonemgr", dest="zonemgr",
help="DNS zone manager e-mail address. Defaults to root")
parser.add_option("-U", "--unattended", dest="unattended", action="store_true",
@@ -167,7 +170,11 @@ def main():
sys.exit("\nPassword is not valid!")
bind.dm_password = read_password("Directory Manager", confirm=False, validate=False)
create_reverse = bindinstance.create_reverse(options.unattended)
create_reverse = True
if options.unattended:
create_reverse = not options.no_reverse
elif not options.no_reverse:
create_reverse = bindinstance.create_reverse()
bind.setup(api.env.host, ip_address, api.env.realm, api.env.domain, dns_forwarders, conf_ntp, create_reverse, zonemgr=options.zonemgr)
if bind.dm_password:

View File

@@ -66,6 +66,8 @@ def parse_options():
help="Add a DNS forwarder")
parser.add_option("--no-forwarders", dest="no_forwarders", action="store_true",
default=False, help="Do not add any DNS forwarders, use root servers instead")
parser.add_option("--no-reverse", dest="no_reverse", action="store_true",
default=False, help="Do not create reverse DNS zone")
parser.add_option("--no-host-dns", dest="no_host_dns", action="store_true",
default=False,
help="Do not use DNS for hostname lookup during installation")
@@ -85,6 +87,8 @@ def parse_options():
parser.error("You cannot specify a --forwarder option without the --setup-dns option")
if options.no_forwarders:
parser.error("You cannot specify a --no-forwarders option without the --setup-dns option")
if options.no_reverse:
parser.error("You cannot specify a --no-reverse option without the --setup-dns option")
elif options.forwarders and options.no_forwarders:
parser.error("You cannot specify a --forwarder option together with --no-forwarders")
elif not options.forwarders and not options.no_forwarders:
@@ -249,7 +253,15 @@ def install_bind(config, options):
ip_address = resolve_host(config.host_name)
if not ip_address:
sys.exit("Unable to resolve IP address for host name")
create_reverse = bindinstance.create_reverse(options.unattended)
create_reverse = True
if options.unattended:
# In unattended mode just use the cmdline flag
create_reverse = not options.no_reverse
elif not options.no_reverse:
# In interactive mode, if the flag was not explicitly specified, ask the user
create_reverse = bindinstance.create_reverse()
bind.setup(config.host_name, ip_address, config.realm_name,
config.domain_name, forwarders, options.conf_ntp, create_reverse)
bind.create_instance()

View File

@@ -99,6 +99,8 @@ def parse_options():
help="Add a DNS forwarder")
parser.add_option("--no-forwarders", dest="no_forwarders", action="store_true",
default=False, help="Do not add any DNS forwarders, use root servers instead")
parser.add_option("--no-reverse", dest="no_reverse", action="store_true",
default=False, help="Do not create reverse DNS zone")
parser.add_option("--zonemgr", dest="zonemgr",
help="DNS zone manager e-mail address. Defaults to root")
parser.add_option("-U", "--unattended", dest="unattended", action="store_true",
@@ -142,6 +144,8 @@ def parse_options():
parser.error("You cannot specify a --forwarder option without the --setup-dns option")
if options.no_forwarders:
parser.error("You cannot specify a --no-forwarders option without the --setup-dns option")
if options.no_reverse:
parser.error("You cannot specify a --no-reverse option without the --setup-dns option")
elif options.forwarders and options.no_forwarders:
parser.error("You cannot specify a --forwarder option together with --no-forwarders")
@@ -545,7 +549,7 @@ def main():
master_password = ""
dm_password = ""
admin_password = ""
create_reverse = False
create_reverse = True
# check bind packages are installed
if options.setup_dns:
@@ -837,7 +841,13 @@ def main():
# Create a BIND instance
bind = bindinstance.BindInstance(fstore, dm_password)
if options.setup_dns:
create_reverse = bindinstance.create_reverse(options.unattended)
if options.unattended:
# In unattended mode just use the cmdline flag
create_reverse = not options.no_reverse
elif not options.no_reverse:
# In interactive mode, if the flag was not explicitly specified, ask the user
create_reverse = bindinstance.create_reverse()
bind.setup(host_name, ip_address, realm_name, domain_name, dns_forwarders, options.conf_ntp, create_reverse, zonemgr=options.zonemgr)
if options.setup_dns:
api.Backend.ldap2.connect(bind_dn="cn=Directory Manager", bind_pw=dm_password)

View File

@@ -58,10 +58,8 @@ def check_inst(unattended):
return True
def create_reverse(unattended):
if unattended:
return False
return ipautil.user_input("Do you want to configure the reverse zone?", False)
def create_reverse():
return ipautil.user_input("Do you want to configure the reverse zone?", True)
def named_conf_exists():
named_fd = open('/etc/named.conf', 'r')
@@ -223,7 +221,7 @@ class BindInstance(service.Service):
self.realm = None
self.forwarders = None
self.sub_dict = None
self.create_reverse = False
self.create_reverse = True
if fstore:
self.fstore = fstore