URL: https://github.com/freeipa/freeipa/pull/857
Author: Tiboris
 Title: #857: baseldap.py: Removes dns-server configuration from ldap
Action: synchronized

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/857/head:pr857
git checkout pr857
From db19101c3fe6ea537c79b9db95bdc965b590aa3a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tibor=20Dudl=C3=A1k?= <tdud...@redhat.com>
Date: Tue, 6 Jun 2017 15:13:26 +0200
Subject: [PATCH] baseldap.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
---
 ipaserver/plugins/server.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/ipaserver/plugins/server.py b/ipaserver/plugins/server.py
index 7aea619b34..b9af4e43e6 100644
--- a/ipaserver/plugins/server.py
+++ b/ipaserver/plugins/server.py
@@ -692,6 +692,15 @@ def _cleanup_server_dns_records(self, hostname, **options):
                     message=_("You may need to manually remove them from the "
                               "tree")))
 
+    def _cleanup_server_dns_config(self, ldap, hostname):
+        dn = self.api.Object.dnsserver.get_dn(hostname)
+        assert isinstance(dn, DN)
+
+        try:
+            ldap.delete_entry(dn)
+        except errors.NotFound:
+            pass
+
     def pre_callback(self, ldap, dn, *keys, **options):
         pkey = self.obj.get_primary_key_from_dn(dn)
 
@@ -731,6 +740,9 @@ def pre_callback(self, ldap, dn, *keys, **options):
         # 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(ldap, pkey)
+
         return dn
 
     def exc_callback(self, keys, options, exc, call_func, *call_args,
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org

Reply via email to