summaryrefslogtreecommitdiffstats
path: root/install/tools/ipa-replica-manage
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/ipa-replica-manage
parentbc7ed9b1e3ad520c7fc61b393ddfa6a99c09de2e (diff)
downloadfreeipa.git-cec3978c799220164ba0f560d3e764a0d879bb05.tar.gz
freeipa.git-cec3978c799220164ba0f560d3e764a0d879bb05.tar.xz
freeipa.git-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/ipa-replica-manage')
-rwxr-xr-xinstall/tools/ipa-replica-manage23
1 files changed, 22 insertions, 1 deletions
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