From 2f99140c92f05c9ff11ff57002cb87784c632091 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Fri, 4 Jul 2014 09:50:58 +0200 Subject: [PATCH] ldapupdate: Restore 'replace' functionality The replace directive was made a no-op by mistake in commit 6381d76. Restore it. Reviewed-By: Martin Kosek --- ipaserver/install/ldapupdate.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ipaserver/install/ldapupdate.py b/ipaserver/install/ldapupdate.py index b6c6d2b90..6bed046d2 100644 --- a/ipaserver/install/ldapupdate.py +++ b/ipaserver/install/ldapupdate.py @@ -625,6 +625,14 @@ class LDAPUpdate: (old, new) = update_value.split('::', 1) except ValueError: raise BadSyntax, "bad syntax in replace, needs to be in the format old::new in %s" % update_value + try: + entry_values.remove(old) + except ValueError: + self.debug('replace: %s not found, skipping', safe_output(attr, old)) + else: + entry_values.append(new) + self.debug('replace: updated value %s', safe_output(attr, entry_values)) + entry[attr] = entry_values return entry