From d71488fd450615ade6c10978af38d0dda27ec859 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tibor=20Dudl=C3=A1k?= <tdudlak@redhat.com>
Date: Tue, 6 Jun 2017 15:13:26 +0200
Subject: [PATCH] server.py: Removes dns-server configuration from ldap
After invocation of the ipa server-del <hostname>
command there was still record in ldap if DNS
was installed on the <hostname> server.
Fixes: https://pagure.io/freeipa/issue/6572
Reviewed-By: Martin Basti <mbasti@redhat.com>
---
ipaserver/plugins/server.py | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/ipaserver/plugins/server.py b/ipaserver/plugins/server.py
index b1ee4722841509f4614c688ac39095c723aff167..e0dc953a1ef870c95fdcdb629fb6ab3103e8f999 100644
--- a/ipaserver/plugins/server.py
+++ b/ipaserver/plugins/server.py
@@ -692,6 +692,12 @@ class server_del(LDAPDelete):
message=_("You may need to manually remove them from the "
"tree")))
+ def _cleanup_server_dns_config(self, hostname):
+ try:
+ self.api.Command.dnsserver_del(hostname)
+ except errors.NotFound:
+ pass
+
def pre_callback(self, ldap, dn, *keys, **options):
pkey = self.obj.get_primary_key_from_dn(dn)
@@ -731,6 +737,9 @@ class server_del(LDAPDelete):
# try to clean up the leftover DNS entries
self._cleanup_server_dns_records(pkey)
+ # try to clean up the DNS config from ldap
+ self._cleanup_server_dns_config(pkey)
+
return dn
def exc_callback(self, keys, options, exc, call_func, *call_args,
--
2.13.5