summaryrefslogtreecommitdiffstats
path: root/install/tools
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2011-01-21 14:46:58 -0500
committerSimo Sorce <ssorce@redhat.com>2011-01-25 14:01:35 -0500
commitcec3978c799220164ba0f560d3e764a0d879bb05 (patch)
treec31e48bd9b3397b8914cccbd0734246b1f824c4b /install/tools
parentbc7ed9b1e3ad520c7fc61b393ddfa6a99c09de2e (diff)
downloadfreeipa-cec3978c799220164ba0f560d3e764a0d879bb05.tar.gz
freeipa-cec3978c799220164ba0f560d3e764a0d879bb05.tar.xz
freeipa-cec3978c799220164ba0f560d3e764a0d879bb05.zip
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
Diffstat (limited to 'install/tools')
-rwxr-xr-xinstall/tools/ipa-replica-install24
-rwxr-xr-xinstall/tools/ipa-replica-manage23
2 files changed, 43 insertions, 4 deletions
diff --git a/install/tools/ipa-replica-install b/install/tools/ipa-replica-install
index 69c0e7ea..b53ceeea 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:
diff --git a/install/tools/ipa-replica-manage b/install/tools/ipa-replica-manage
index 80974545..8f0b7c59 100755
--- a/install/tools/ipa-replica-manage
+++ b/install/tools/ipa-replica-manage
@@ -24,9 +24,10 @@ import traceback, logging
from ipapython import ipautil
from ipaserver.install import replication, dsinstance, installutils
+from ipaserver.install import bindinstance
from ipaserver import ipaldap
from ipapython import version
-from ipalib import errors, util
+from ipalib import api, errors, util
CACERT = "/etc/ipa/ca.crt"
@@ -274,6 +275,21 @@ def del_master(realm, hostname, options):
print "Failed to cleanup %s entries: %s" % (hostname, str(e))
print "You may need to manually remove them from the tree"
+ # 5. And clean up the removed replica DNS entries if any.
+ try:
+ if bindinstance.dns_container_exists(options.host, thisrepl.suffix):
+ if options.dirman_passwd:
+ api.Backend.ldap2.connect(bind_dn='cn=Directory Manager',
+ bind_pw=options.dirman_passwd)
+ else:
+ ccache = krbV.default_context().default_ccache().name
+ api.Backend.ldap2.connect(ccache=ccache)
+ bind = bindinstance.BindInstance()
+ bind.remove_master_dns_records(hostname, realm, realm.lower())
+ except Exception, e:
+ print "Failed to cleanup %s DNS entries: %s" % (hostname, str(e))
+ print "You may need to manually remove them from the tree"
+
def add_link(realm, replica1, replica2, dirman_passwd, options):
if options.winsync:
@@ -355,6 +371,11 @@ def force_sync(realm, thishost, fromhost, dirman_passwd):
def main():
options, args = parse_options()
+ # Just initialize the environment. This is so the installer can have
+ # access to the plugin environment
+ api.bootstrap(in_server=True)
+ api.finalize()
+
dirman_passwd = None
realm = krbV.default_context().default_realm