Univention Bugzilla – Bug 37119
UDM_Error: Value is required. The property Primary group is required
Last modified: 2015-10-14 12:28:36 CEST
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
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"}
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
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
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.
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
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
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
http://errata.univention.de/ucs/4.0/89.html
Reported again, 3.2-7 errata372 (Borgfeld)