summaryrefslogtreecommitdiffstats
path: root/ipaserver/install/ldapupdate.py
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2012-11-15 21:38:26 -0500
committerMartin Kosek <mkosek@redhat.com>2012-11-21 14:55:12 +0100
commitf1f1b4e7f2e9c1838ad7ec76002b78ca0c2a3c46 (patch)
tree7c563571ef9e8ac8599cd81a5b17422d79eb2f59 /ipaserver/install/ldapupdate.py
parent2093007d4d2b3183b65a07d421954b3e8a12e93b (diff)
downloadfreeipa-f1f1b4e7f2e9c1838ad7ec76002b78ca0c2a3c46.tar.gz
freeipa-f1f1b4e7f2e9c1838ad7ec76002b78ca0c2a3c46.tar.xz
freeipa-f1f1b4e7f2e9c1838ad7ec76002b78ca0c2a3c46.zip
Enable transactions by default, make password and modrdn TXN-aware
The password and modrdn plugins needed to be made transaction aware for the pre and post operations. Remove the reverse member hoop jumping. Just fetch the entry once and all the memberof data is there (plus objectclass). Fix some unit tests that are failing because we actually get the data now due to transactions. Add small bit of code in user plugin to retrieve the user again ala wait_for_attr but in the case of transactions we need do it only once. Deprecate wait_for_attr code. Add a memberof fixup task for roles. https://fedorahosted.org/freeipa/ticket/1263 https://fedorahosted.org/freeipa/ticket/1891 https://fedorahosted.org/freeipa/ticket/2056 https://fedorahosted.org/freeipa/ticket/3043 https://fedorahosted.org/freeipa/ticket/3191 https://fedorahosted.org/freeipa/ticket/3046
Diffstat (limited to 'ipaserver/install/ldapupdate.py')
-rw-r--r--ipaserver/install/ldapupdate.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/ipaserver/install/ldapupdate.py b/ipaserver/install/ldapupdate.py
index eb95858f9..f7261adc4 100644
--- a/ipaserver/install/ldapupdate.py
+++ b/ipaserver/install/ldapupdate.py
@@ -59,7 +59,7 @@ class BadSyntax(installutils.ScriptError):
return repr(self.value)
class LDAPUpdate:
- action_keywords = ["default", "add", "remove", "only", "deleteentry", "replace", "addifnew", "addifexist"]
+ action_keywords = ["default", "add", "remove", "only", "onlyifexist", "deleteentry", "replace", "addifnew", "addifexist"]
def __init__(self, dm_password, sub_dict={}, live_run=True,
online=True, ldapi=False, plugins=False):
@@ -623,6 +623,18 @@ class LDAPUpdate:
only[attr] = True
entry.setValues(attr, entry_values)
self.debug('only: updated value %s', entry_values)
+ elif action == 'onlyifexist':
+ self.debug("onlyifexist: '%s' to %s, current value %s", update_value, attr, entry_values)
+ # Only set the attribute if the entry exist's. We
+ # determine this based on whether it has an objectclass
+ if entry.getValues('objectclass'):
+ if only.get(attr):
+ entry_values.append(update_value)
+ else:
+ entry_values = [update_value]
+ only[attr] = True
+ self.debug('onlyifexist: set %s to %s', attr, entry_values)
+ entry.setValues(attr, entry_values)
elif action == 'deleteentry':
# skip this update type, it occurs in __delete_entries()
return None