From fe00788bb439d461e1429ffbd94e42d615e2ddf9 Mon Sep 17 00:00:00 2001 From: Jan Cholasta Date: Mon, 15 Apr 2013 12:19:35 +0200 Subject: Delete DNS records in ipa-ca on ipa-csreplica-manage del. https://fedorahosted.org/freeipa/ticket/3547 --- install/tools/ipa-csreplica-manage | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'install/tools/ipa-csreplica-manage') diff --git a/install/tools/ipa-csreplica-manage b/install/tools/ipa-csreplica-manage index b9fa05f94..d70f24e26 100755 --- a/install/tools/ipa-csreplica-manage +++ b/install/tools/ipa-csreplica-manage @@ -25,7 +25,7 @@ import os import krbV from ipapython.ipa_log_manager import * -from ipaserver.install import replication, installutils +from ipaserver.install import replication, installutils, bindinstance from ipalib import api, errors, util from ipapython import ipautil, ipaldap, version, dogtag from ipapython.dn import DN @@ -271,6 +271,18 @@ def del_master(realm, hostname, options): except Exception, e: sys.exit("There were issues removing a connection: %s" % e) + # 6. And clean up the removed replica DNS entries if any. + try: + if bindinstance.dns_container_exists(options.host, api.env.basedn, + dm_password=options.dirman_passwd): + api.Backend.ldap2.connect(bind_dn=DN(('cn', 'Directory Manager')), + bind_pw=options.dirman_passwd) + bind = bindinstance.BindInstance() + bind.remove_ipa_ca_dns_records(hostname, realm.lower()) + except Exception, e: + print "Failed to cleanup %s DNS entries: %s" % (hostname, e) + print "You may need to manually remove them from the tree" + def add_link(realm, replica1, replica2, dirman_passwd, options): try: repl2 = replication.get_cs_replication_manager(realm, replica2, -- cgit