pgreco / rpms / ipa

Forked from forks/areguera/rpms/ipa 4 years ago
Clone

Blame SOURCES/0046-Fix-upgrade-update_replica_config-in-single-master-m.patch

2f4199
From 6d868b2dd17ada072553c8d7440ee6fbd95a052a Mon Sep 17 00:00:00 2001
2f4199
From: Fraser Tweedale <ftweedal@redhat.com>
2f4199
Date: Mon, 16 Apr 2018 16:02:03 +1000
2f4199
Subject: [PATCH] Fix upgrade (update_replica_config) in single master mode
2f4199
2f4199
Commit afc0d4b62d043cd568ce87400f60e8fa8273495f added an upgrade
2f4199
step that add an attribute to a replica config entry.  The entry
2f4199
only exists after a replica has been added, so upgrade was broken
2f4199
for standalone server.  Catch and suppress the NotFound error.
2f4199
2f4199
Related to: https://pagure.io/freeipa/issue/7488
2f4199
2f4199
Reviewed-By: Christian Heimes <cheimes@redhat.com>
2f4199
Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
2f4199
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
2f4199
---
2f4199
 ipaserver/install/server/upgrade.py | 6 +++++-
2f4199
 1 file changed, 5 insertions(+), 1 deletion(-)
2f4199
2f4199
diff --git a/ipaserver/install/server/upgrade.py b/ipaserver/install/server/upgrade.py
2f4199
index 62a75510ad331923f468c28908ea407789ec380c..c55242a4af990c3218d8451fac7b082066a23be3 100644
2f4199
--- a/ipaserver/install/server/upgrade.py
2f4199
+++ b/ipaserver/install/server/upgrade.py
2f4199
@@ -1570,7 +1570,11 @@ def update_replica_config(db_suffix):
2f4199
         ('cn', 'replica'), ('cn', db_suffix), ('cn', 'mapping tree'),
2f4199
         ('cn', 'config')
2f4199
     )
2f4199
-    entry = api.Backend.ldap2.get_entry(dn)
2f4199
+    try:
2f4199
+        entry = api.Backend.ldap2.get_entry(dn)
2f4199
+    except ipalib.errors.NotFound:
2f4199
+        return  # entry does not exist until a replica is installed
2f4199
+
2f4199
     if 'nsds5replicareleasetimeout' not in entry:
2f4199
         # See https://pagure.io/freeipa/issue/7488
2f4199
         root_logger.info("Adding nsds5replicaReleaseTimeout=60 to %s", dn)
2f4199
-- 
2f4199
2.14.3
2f4199