Bug 12964

Summary: traceback when value provided by --append is already set
Product: UCS Reporter: Felix Botner <botner>
Component: UDM - CLIAssignee: UMC maintainers <umc-maintainers>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P5 CC: best, gohmann, requate, schwardt
Version: UCS 4.1   
Target Milestone: UCS 3.x   
Hardware: All   
OS: All   
See Also: https://forge.univention.org/bugzilla/show_bug.cgi?id=32638
https://forge.univention.org/bugzilla/show_bug.cgi?id=43247
What kind of report is it?: --- What type of bug is this?: ---
Who will be affected by this bug?: --- How will those affected feel about the bug?: ---
User Pain: Enterprise Customer affected?:
School Customer affected?: ISV affected?:
Waiting Support: Flags outvoted (downgraded) after PO Review:
Ticket number: Bug group (optional):
Max CVSS v3 score:

Description Felix Botner univentionstaff 2008-12-18 15:17:45 CET
univention-admin settings/printermodel modify --ignore_exists --dn cn=HP,cn=cups,cn=univention,dc=uni --append 'printmodel="bla" "bla"'

und dann nochmal 

univention-admin settings/printermodel modify --ignore_exists --dn cn=HP,cn=cups,cn=univention,dc=uni --append 'printmodel="bla" "bla"'

Traceback (most recent call last):
  File "/usr/share/univention-directory-manager-tools/univention-cli-server", line 231, in doit
    output = univention.admincli.admin.doit(arglist)
  File "/usr/lib/python2.4/site-packages/univention/admincli/admin.py", line 894, in doit
    dn=object.modify()
  File "/usr/lib/python2.4/site-packages/univention/admin/handlers/__init__.py", line 302, in modify
    return self._modify(modify_childs,ignore_license=ignore_license)
  File "/usr/lib/python2.4/site-packages/univention/admin/handlers/__init__.py", line 657, in _modify
    self.lo.modify(self.dn, ml, ignore_license=ignore_license)
  File "/usr/lib/python2.4/site-packages/univention/admin/uldap.py", line 353, in modify
    raise univention.admin.uexceptions.ldapError, msg[0]['desc']
ldapError: Type or value exists

mir ist dann im updater.log ausgefallen, dort versucht das join script des 
univention-prinserver so etwas
Comment 1 Janek Walkenhorst univentionstaff 2010-07-21 14:01:12 CEST
*** Bug 18893 has been marked as a duplicate of this bug. ***
Comment 2 Arvid Requate univentionstaff 2010-08-04 16:50:04 CEST
Da wird die Exception ldap.TYPE_OR_VALUE_EXISTS geworfen, das ist noch nicht in uldap.py/uexceptions.py gemapped.

Es sollte dann vor einer Anpassung des Verhaltens geprüft werden, ob es sinnvoll ist das so zu implementieren, dass ein modify mit mehreren --append die Modifikationen durchführt die fehlerfrei möglich sind und für die ignorierten Modifikationen (jeweils?!) eine Meldung auszugeben.
Comment 3 Stefan Gohmann univentionstaff 2012-05-16 20:34:48 CEST
Das Verhalten tritt auch auf, wenn ein Benutzer bereits in einer Gruppe ist:


root@master101:~# udm groups/group modify "$@" --ignore_exists                 --dn "cn=Group Policy Creator Owners,cn=groups,$ldap_base"                 --append users="uid=administrator,CN=Users,$ldap_base" 
Traceback (most recent call last):
  File "/usr/share/univention-directory-manager-tools/univention-cli-server", line 233, in doit
    output = univention.admincli.admin.doit(arglist)
  File "/usr/lib/pymodules/python2.6/univention/admincli/admin.py", line 938, in doit
    dn=object.modify()
  File "/usr/lib/pymodules/python2.6/univention/admin/handlers/__init__.py", line 344, in modify
    return self._modify(modify_childs,ignore_license=ignore_license)
  File "/usr/lib/pymodules/python2.6/univention/admin/handlers/__init__.py", line 863, in _modify
    self.lo.modify(self.dn, ml, ignore_license=ignore_license)
  File "/usr/lib/pymodules/python2.6/univention/admin/uldap.py", line 385, in modify
    raise univention.admin.uexceptions.ldapError, _err2str(msg)
ldapError: Type or value exists: modify/add: uniqueMember: value #0 already exists
root@master101:~#
Comment 4 Florian Best univentionstaff 2016-09-28 15:35:54 CEST
The option "--ignore-exists" means "ignore if that object already exists".
The option "--ignore-exists" doesn't exists for the modify operation!
The option "--ignore-exists" does NOT mean ignore if all the provided values are already set.

Nevertheless we often have troubles when we want to append a value where we are not sure if this is already set.
The best case would to just print a WARNING for each already set value.
Comment 5 Florian Best univentionstaff 2016-09-28 15:45:13 CEST
Another one:

# udm policies/registry create --set name=test --append registry="foo bar"
Object created: cn=test,dc=school,dc=local
# udm policies/registry modify --dn "cn=test,$(ucr get ldap/base)" --append registry="foo bar"
E: Invalid Syntax: Duplicated variables not allowed: 'foo'
Comment 6 Florian Best univentionstaff 2016-11-05 00:28:54 CET
*** Bug 28756 has been marked as a duplicate of this bug. ***
Comment 7 Florian Best univentionstaff 2016-11-05 02:36:23 CET
Bug #32638 might be a duplicate.
Comment 8 Florian Best univentionstaff 2016-12-23 14:34:23 CET
groups/groups has been fixed in Bug #43247
Comment 9 Florian Best univentionstaff 2017-07-04 13:03:28 CEST
The patch in Bug #43286 will also fix this.

*** This bug has been marked as a duplicate of bug 43286 ***