diff options
author | Rob Crittenden <rcritten@redhat.com> | 2011-04-14 14:37:45 -0400 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2011-04-15 13:02:17 +0200 |
commit | fe67680da5c3d7799884bdbd4d900070394dc5d0 (patch) | |
tree | bf51ade36d8d0895b28f8d059c1ed2f91dac6058 /ipaserver | |
parent | e3ec1fb7efb12c3669855b6c388f196c268680ee (diff) | |
download | freeipa-fe67680da5c3d7799884bdbd4d900070394dc5d0.tar.gz freeipa-fe67680da5c3d7799884bdbd4d900070394dc5d0.tar.xz freeipa-fe67680da5c3d7799884bdbd4d900070394dc5d0.zip |
The default groups we create should have ipaUniqueId set
This adds a new directive to ipa-ldap-updater: addifnew. This will add
a new attribute only if it doesn't exist in the current entry. We can't
compare values because the value we are adding is automatically generated.
ticket 1177
Diffstat (limited to 'ipaserver')
-rw-r--r-- | ipaserver/install/ldapupdate.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/ipaserver/install/ldapupdate.py b/ipaserver/install/ldapupdate.py index 5a827fdfb..0b5c9441a 100644 --- a/ipaserver/install/ldapupdate.py +++ b/ipaserver/install/ldapupdate.py @@ -249,7 +249,7 @@ class LDAPUpdate: def parse_update_file(self, data, all_updates, dn_list): """Parse the update file into a dictonary of lists and apply the update for each DN in the file.""" - valid_keywords = ["default", "add", "remove", "only", "deleteentry", "replace"] + valid_keywords = ["default", "add", "remove", "only", "deleteentry", "replace", "addifnew"] update = {} d = "" index = "" @@ -461,6 +461,14 @@ class LDAPUpdate: e.append(v) logging.debug('add: updated value %s', e) entry.setValues(k, e) + elif utype == 'addifnew': + logging.debug("addifnew: '%s' to %s, current value %s", v, k, e) + # Only add the attribute if it doesn't exist. Only works + # with single-value attributes. + if len(e) == 0: + e.append(v) + logging.debug('addifnew: set %s to %s', (k, e)) + entry.setValues(k, e) elif utype == 'only': logging.debug("only: set %s to '%s', current value %s", k, v, e) if only.get(k): |