ldapupdate: Restore 'replace' functionality

The replace directive was made a no-op by mistake in commit 6381d76.
Restore it.

Reviewed-By: Martin Kosek <mkosek@redhat.com>
This commit is contained in:
Petr Viktorin authored and Martin Kosek committed 2014-07-04 15:51:55 +02:00
1 parent f8b6595f49
commit 2f99140c92
1 file changed
+8
+8
View File
@@ -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