URL: https://github.com/freeipa/freeipa/pull/1812
Author: frasertweedale
 Title: #1812: Fix upgrade (update_replica_config) in single master mode
Action: opened

PR body:
"""
Commit afc0d4b62d043cd568ce87400f60e8fa8273495f added an upgrade
step that add an attribute to a replica config entry.  The entry
only exists after a replica has been added, so upgrade was broken
for standalone server.  Catch and suppress the NotFound error.

Related to: https://pagure.io/freeipa/issue/7488
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/1812/head:pr1812
git checkout pr1812
From b31adf9cc8d1f7e9701012b8c21ab46a84a14cef Mon Sep 17 00:00:00 2001
From: Fraser Tweedale <ftwee...@redhat.com>
Date: Mon, 16 Apr 2018 16:02:03 +1000
Subject: [PATCH] Fix upgrade (update_replica_config) in single master mode

Commit afc0d4b62d043cd568ce87400f60e8fa8273495f added an upgrade
step that add an attribute to a replica config entry.  The entry
only exists after a replica has been added, so upgrade was broken
for standalone server.  Catch and suppress the NotFound error.

Related to: https://pagure.io/freeipa/issue/7488
---
 ipaserver/install/server/upgrade.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/ipaserver/install/server/upgrade.py b/ipaserver/install/server/upgrade.py
index ed845027ae..31c09d85d8 100644
--- a/ipaserver/install/server/upgrade.py
+++ b/ipaserver/install/server/upgrade.py
@@ -1642,7 +1642,11 @@ def update_replica_config(db_suffix):
         ('cn', 'replica'), ('cn', db_suffix), ('cn', 'mapping tree'),
         ('cn', 'config')
     )
-    entry = api.Backend.ldap2.get_entry(dn)
+    try:
+        entry = api.Backend.ldap2.get_entry(dn)
+    except ipalib.errors.NotFound:
+        return  # entry does not exist until a replica is installed
+
     if 'nsds5replicareleasetimeout' not in entry:
         # See https://pagure.io/freeipa/issue/7488
         logger.info("Adding nsds5replicaReleaseTimeout=60 to %s", dn)
_______________________________________________
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