URL: https://github.com/freeipa/freeipa/pull/1821
Author: abbra
 Title: #1821: [backport ipa-4-5] upgrade: treat duplicate entry when updating 
as not an error
Action: opened

PR body:
"""
When we attempt to update an entry during upgrade, it may have already
contain the data in question between the check and the update. Ignore
the change in this case and record it in the log.

Fixes: https://pagure.io/freeipa/issue/7450
(cherry picked from commit 52c0d8c5bfc4d0c1fe8d8318edbf5909d139178c)
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/1821/head:pr1821
git checkout pr1821
From 4364544595300c249952b430ebd37c3822a1e3ad Mon Sep 17 00:00:00 2001
From: Alexander Bokovoy <aboko...@redhat.com>
Date: Mon, 16 Apr 2018 16:55:57 +0300
Subject: [PATCH] upgrade: treat duplicate entry when updating as not an error

When we attempt to update an entry during upgrade, it may have already
contain the data in question between the check and the update. Ignore
the change in this case and record it in the log.

Fixes: https://pagure.io/freeipa/issue/7450
(cherry picked from commit 52c0d8c5bfc4d0c1fe8d8318edbf5909d139178c)
---
 ipaserver/install/ldapupdate.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ipaserver/install/ldapupdate.py b/ipaserver/install/ldapupdate.py
index c6ab3e2afc..069677d44e 100644
--- a/ipaserver/install/ldapupdate.py
+++ b/ipaserver/install/ldapupdate.py
@@ -21,6 +21,7 @@
 
 # TODO
 # save undo files?
+from __future__ import absolute_import
 
 import base64
 import sys
@@ -812,6 +813,9 @@ def _update_record(self, update):
             except errors.DatabaseError as e:
                 self.error("Update failed: %s", e)
                 updated = False
+            except errors.DuplicateEntry as e:
+                logger.debug("Update already exists, skip it: %s", e)
+                updated = False
             except errors.ACIError as e:
                 self.error("Update failed: %s", e)
                 updated = False
_______________________________________________
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