Server Upgrade: fix remove statement

If value does not exists then do not update entry. Otherwise, together with
nonexistent entry, the LDAP decode error will be raised.

https://fedorahosted.org/freeipa/ticket/4904

Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
This commit is contained in:
Martin Basti 2015-05-25 14:57:04 +02:00 committed by Jan Cholasta
parent f903c2d5bf
commit 9eedffdfa6

View File

@ -648,9 +648,10 @@ class LDAPUpdate:
entry_values.remove(update_value)
except ValueError:
self.warning("remove: '%s' not in %s", update_value, attr)
pass
entry[attr] = entry_values
self.debug('remove: updated value %s', safe_output(attr, entry_values))
else:
entry[attr] = entry_values
self.debug('remove: updated value %s', safe_output(
attr, entry_values))
elif action == 'add':
self.debug("add: '%s' to %s, current value %s", safe_output(attr, update_value), attr, safe_output(attr, entry_values))
# Remove it, ignoring errors so we can blindly add it later