From cec3978c799220164ba0f560d3e764a0d879bb05 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Fri, 21 Jan 2011 14:46:58 -0500 Subject: Always add DNS records when installing a replica Even if the replica is not running a DNS server other replicas might. So if the DNS container is present, then try to add DNS records. Fixes: https://fedorahosted.org/freeipa/ticket/824 --- install/tools/ipa-replica-install | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'install/tools/ipa-replica-install') diff --git a/install/tools/ipa-replica-install b/install/tools/ipa-replica-install index 69c0e7eac..b53ceeea4 100755 --- a/install/tools/ipa-replica-install +++ b/install/tools/ipa-replica-install @@ -245,6 +245,8 @@ def install_http(config): sys.exit(1) def install_bind(config, options): + api.Backend.ldap2.connect(bind_dn="cn=Directory Manager", + bind_pw=config.dirman_password) if options.forwarders: forwarders = options.forwarders else: @@ -266,6 +268,23 @@ def install_bind(config, options): config.domain_name, forwarders, options.conf_ntp, create_reverse) bind.create_instance() +def install_dns_records(config, options): + + if not bindinstance.dns_container_exists(config.host_name, + util.realm_to_suffix(config.realm_name)): + return + + api.Backend.ldap2.connect(bind_dn="cn=Directory Manager", + bind_pw=config.dirman_password) + bind = bindinstance.BindInstance(dm_password=config.dirman_password) + ip_address = resolve_host(config.host_name) + if not ip_address: + sys.exit("Unable to resolve IP address for host name") + + bind.add_master_dns_records(config.host_name, ip_address, + config.realm_name, config.domain_name, + options.conf_ntp) + def check_dirsrv(): serverids = dsinstance.check_existing_installation() if serverids: @@ -432,10 +451,9 @@ def main(): service.restart("httpd") if options.setup_dns: - api.Backend.ldap2.connect(bind_dn="cn=Directory Manager", - bind_pw=config.dirman_password) - install_bind(config, options) + else: + install_dns_records(config, options) # Call client install script try: -- cgit