URL: https://github.com/freeipa/freeipa/pull/1815
Author: abbra
 Title: #1815: 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
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/1815/head:pr1815
git checkout pr1815
From 52c0d8c5bfc4d0c1fe8d8318edbf5909d139178c 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 c3a5e92f54..78377079e5 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