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