URL: https://github.com/freeipa/freeipa/pull/1820
Author: tiran
 Title: #1820: [Backport][ipa-4-6] upgrade: treat duplicate entry when updating 
as not an error
Action: opened

PR body:
"""
This PR was opened automatically because PR #1815 was pushed to master and 
backport to ipa-4-6 is required.
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/1820/head:pr1820
git checkout pr1820
From 211847487f9f6efa2a9736ec236a1fae61bcacac 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
---
 ipaserver/install/ldapupdate.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ipaserver/install/ldapupdate.py b/ipaserver/install/ldapupdate.py
index 63bc80df8f..15fa22a67d 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 logging
@@ -849,6 +850,9 @@ def _update_record(self, update):
             except errors.DatabaseError as e:
                 logger.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:
                 logger.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