Blob Blame History Raw
From 3ff9fc2141e16e7cbd4fa30c16d60e915c2c3ee4 Mon Sep 17 00:00:00 2001
From: Martin Babinsky <mbabinsk@redhat.com>
Date: Wed, 7 Dec 2016 14:00:09 +0100
Subject: [PATCH] add missing attribute to ipaca replica during CA topology
 update

'nsds5replicabinddngroupcheckinterval' attribute was not properly added
to 'o=ipaca' replica attribute during upgrade. The CA topology update
plugin should now add it to the entry if it exists.

https://fedorahosted.org/freeipa/ticket/6508

Reviewed-By: Martin Basti <mbasti@redhat.com>
---
 ipaserver/install/plugins/update_ca_topology.py | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/ipaserver/install/plugins/update_ca_topology.py b/ipaserver/install/plugins/update_ca_topology.py
index d76849bf9de46b1e4ad52dbae7081b4d3aec5273..f82926b19175c3fd42bd794205ec4216fc776707 100644
--- a/ipaserver/install/plugins/update_ca_topology.py
+++ b/ipaserver/install/plugins/update_ca_topology.py
@@ -2,8 +2,10 @@
 # Copyright (C) 2015  FreeIPA Contributors see COPYING for license
 #
 
+from ipalib import errors
 from ipalib import Registry
 from ipalib import Updater
+from ipapython.dn import DN
 from ipaserver.install import certs, cainstance
 from ipaserver.install import ldapupdate
 from ipaplatform.paths import paths
@@ -31,4 +33,24 @@ class update_ca_topology(Updater):
 
         ld.update([paths.CA_TOPOLOGY_ULDIF])
 
+        ldap = self.api.Backend.ldap2
+
+        ca_replica_dn = DN(
+            ('cn', 'replica'),
+            ('cn', 'o=ipaca'),
+            ('cn', 'mapping tree'),
+            ('cn', 'config'))
+
+        check_interval_attr = 'nsds5replicabinddngroupcheckinterval'
+        default_check_interval = ['60']
+
+        try:
+            ca_replica_entry = ldap.get_entry(ca_replica_dn)
+        except errors.NotFound:
+            pass
+        else:
+            if check_interval_attr not in ca_replica_entry:
+                ca_replica_entry[check_interval_attr] = default_check_interval
+                ldap.update_entry(ca_replica_entry)
+
         return False, []
-- 
2.7.4