Bug 37119 - UDM_Error: Value is required. The property Primary group is required
UDM_Error: Value is required. The property Primary group is required
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UMC - Domain management (Generic)
UCS 4.0
Other Linux
: P5 normal (vote)
: UCS 4.0-1-errata
Assigned To: Florian Best
Philipp Hahn
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-12-01 10:04 CET by Florian Best
Modified: 2015-10-14 12:28 CEST (History)
2 users (show)

See Also:
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): Error handling, External feedback
Max CVSS v3 score:
best: Patch_Available+


Attachments
patch (8.46 KB, patch)
2015-01-23 10:19 CET, Florian Best
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Best univentionstaff 2014-12-01 10:04:47 CET
Traceback:
  File "/usr/lib/pymodules/python2.7/notifier/threads.py", line 82, in _run
    tmp = self._function()
  File "/usr/lib/pymodules/python2.7/notifier/__init__.py", line 104, in __call__
    return self._function( *tmp, **self._kwargs )
  File
"/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/__init__.py", line
1084, in _thread
    object_dn, container_dn, obj = _get_object_parts(ioptions)
  File
"/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/__init__.py", line
1066, in _get_object_parts
    _obj, _module = _get_object(_object_dn, UDM_Module(_object_type))
  File
"/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/__init__.py", line
1044, in _get_object
    _obj = _module.get( _dn )
  File
"/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/udm_ldap.py", line
184, in wrapper_func
    ret = func( *args, **kwargs )
  File
"/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/udm_ldap.py", line
506, in get
    raise UDM_Error( get_exception_msg( e ) )

UDM_Error: Value is required. The property Primary group is required
Comment 1 Florian Best univentionstaff 2014-12-02 23:44:11 CET
This is now reproducible:
Create a user without posix option. give him users/self or password-admin permission. Use one of these modules. "primaryGroup" and "$dn$" are internally changing → the JS code sends these values along with the request. Bug #31884 for more information.

d.getAlteredValues()
Object {primaryGroup: "cn=Account Operators,cn=Builtin,dc=ucs,dc=dev", $dn$: "uid=noposix,cn=users,dc=ucs,dc=dev"}
Comment 2 Florian Best univentionstaff 2015-01-23 09:38:40 CET
This happens also when you modify a win7 computer which does not exists, e.g:
udm computers/windows modify --set network=cn=schule-10.128.0.0,cn=networks,ou=schule,dc=asdf,dc=lokal --dn cn=win7-5,cn=computers,ou=grundschule,dc=asdf,dc=lokal
Comment 3 Florian Best univentionstaff 2015-01-23 10:07:05 CET
Expected result:
udm should raise noObject (later in modify()).
Actual result:
udm open()s the object which requires that there is a primary group but the object does not exists so it does not have any attributes.

Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/univention/admincli/admin.py", line 393, in doit
    out=_doit(arglist)
  File "/usr/lib/pymodules/python2.7/univention/admincli/admin.py", line 925, in _doit
    object.open()
  File "/usr/lib/pymodules/python2.7/univention/admin/handlers/computers/windows.py", line 424, in open
    self['primaryGroup']=None
  File "/usr/lib/pymodules/python2.7/univention/admin/handlers/__init__.py", line 2736, in __setitem__
    super(simpleComputer, self).__setitem__(key, value)
  File "/usr/lib/pymodules/python2.7/univention/admin/handlers/__init__.py", line 245, in __setitem__
    raise univention.admin.uexceptions.valueRequired, _('The property %s is required') % self.descriptions[key].short_description
valueRequired: The property Primary group is required
Comment 4 Florian Best univentionstaff 2015-01-23 10:19:32 CET
Created attachment 6627 [details]
patch

Most computer objects are overwriting the open() method. To check if the object exists they are using 'if self.dn' which is wrong because the dn is set even if you modify a not existing object. self.exists() must be used instead which is already set because the super class open() method is already called.
Comment 5 Florian Best univentionstaff 2015-02-02 09:46:11 CET
I found another way to provoke this:
open a user object in UMC, delete it in a second tab, switch to the tab with the policies → you will receive this traceback:

Execution of command 'udm/object/policies users/user' has failed:

Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/__init__.py", line 176, in _decorated
    return function(self, request, *args, **kwargs)
  File "/usr/lib/pymodules/python2.7/notifier/threads.py", line 82, in _run
    tmp = self._function()
  File "/usr/lib/pymodules/python2.7/notifier/__init__.py", line 104, in __call__
    return self._function( *tmp, **self._kwargs )
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/__init__.py", line 1102, in _thread
    object_dn, container_dn, obj = _get_object_parts(ioptions)
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/__init__.py", line 1084, in _get_object_parts
    _obj, _module = _get_object(_object_dn, UDM_Module(_object_type))
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/__init__.py", line 1062, in _get_object
    _obj = _module.get(_dn)
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/udm_ldap.py", line 159, in _decorated
    return func(*args, **kwargs)
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/udm_ldap.py", line 139, in wrapper_func
    ret = func(*args, **kwargs)
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/udm_ldap.py", line 623, in get
    UDM_Error(exc).reraise()
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/udm_ldap.py", line 613, in get
    obj.open()
  File "/usr/lib/pymodules/python2.7/univention/admin/handlers/users/user.py", line 1456, in open
    self['primaryGroup']=None
  File "/usr/lib/pymodules/python2.7/univention/admin/handlers/__init__.py", line 234, in __setitem__
    raise univention.admin.uexceptions.valueRequired, _('The property %s is required') % self.descriptions[key].short_description
UDM_Error: Value is required. The property Primary group is required
Comment 6 Florian Best univentionstaff 2015-02-10 19:24:25 CET
All checks for self.dn in open() methods have been replaced by self.exists().

Bug #37119: use self.exists() instead of self.dn in open() to verify existance of object. self.dn may be passed to object.__init__ by code which assumes a object for the DN really exists. This leads to various strange subsequent errors e.g. when required properties aren't set. Replacing it with self.exists() should
work as we have verified that the object exists then.

Fix: svn r57949
YAML: 2015-02-10-univention-directory-manager-modules.yaml
Comment 7 Philipp Hahn univentionstaff 2015-02-17 23:02:35 CET
OK: udm computers/windows modify --set network=`udm networks/network list | sed -ne 's/^DN: //p;T;q'` --dn cn=win7-5,cn=computers,`ucr get ldap/base`
> Value is required: The property Primary group is required

OK: aptitude install '?source-package(univention-directory-manager-modules)?installed'

OK: udm computers/windows modify --set network=`udm networks/network list | sed -ne 's/^DN: //p;T;q'` --dn cn=win7-5,cn=computers,`ucr get ldap/base`
> E: object not found

OK: errata-announce -V 2015-02-10-univention-directory-manager-modules.yaml
FIXED: exist{a->e}nce
 r58181 | Bug #37119 UDM QA: Fix spelling YAML
Comment 8 Moritz Muehlenhoff univentionstaff 2015-02-24 08:24:33 CET
http://errata.univention.de/ucs/4.0/89.html
Comment 9 Florian Best univentionstaff 2015-10-14 12:28:36 CEST
Reported again, 3.2-7 errata372 (Borgfeld)