URL: https://github.com/freeipa/freeipa/pull/311
Author: martbab
 Title: #311: bindinstance: use LDAP to determine configuration status
Action: opened

PR body:
"""
Instead of checking sysrestore status which leads to incorrect
evaluation of DNS configuration status during 4.2 -> 4.4 upgrade, use
server roles API to query DNS server role status on the master.

Use the default implementation only if LDAP connection is unavailable or
stale.

https://fedorahosted.org/freeipa/ticket/6503
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/311/head:pr311
git checkout pr311
From 43872f010b18db80f6d4c11cf282e8bb8dd665d3 Mon Sep 17 00:00:00 2001
From: Martin Babinsky <mbabi...@redhat.com>
Date: Mon, 28 Nov 2016 17:24:20 +0100
Subject: [PATCH] bindinstance: use LDAP to determine configuration status

Instead of checking sysrestore status which leads to incorrect
evaluation of DNS configuration status during 4.2 -> 4.4 upgrade, use
server roles API to query DNS server role status on the master.

Use the default implementation only if LDAP connection is unavailable or
stale.

https://fedorahosted.org/freeipa/ticket/6503
---
 ipaserver/install/bindinstance.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/ipaserver/install/bindinstance.py b/ipaserver/install/bindinstance.py
index a944be2..fe6ed33 100644
--- a/ipaserver/install/bindinstance.py
+++ b/ipaserver/install/bindinstance.py
@@ -39,6 +39,7 @@
 from ipaserver.install import installutils
 from ipaserver.install import service
 from ipaserver.install import sysupgrade
+from ipaserver import servroles
 from ipapython import ipautil
 from ipapython import dnsutil
 from ipapython.dnsutil import DNSName
@@ -1061,6 +1062,18 @@ def remove_master_dns_records(self, fqdn, realm_name, domain_name):
                        api=self.api)
         self.update_system_records()
 
+    def is_configured(self):
+        if self.api.Backend.ldap2.isconnected():
+            try:
+                result = self.api.Command.server_role_show(
+                    unicode(self.fqdn), u'DNS server')['result']
+
+                return result[u'status'] != servroles.ABSENT
+            except errors.NetworkError:
+                pass
+
+        return super(BindInstance, self).is_configured()
+
     def remove_server_ns_records(self, fqdn):
         """
         Remove all NS records pointing to this server
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to