Univention Bugzilla – Bug 37375
invalid DN syntax is used for Creating Container when creating new OU
Last modified: 2016-11-14 14:43:39 CET
Created attachment 6543 [details] Full output. In the last jenkins run #12, when calling "schoolenv.create_ou()", an invalid DN is passed to creating container: Full example output is attached. . . Creating Container(name='groups', school='', dn='cn=groups,dc=autotest201,dc=local') Creating Container(name='ucsschool', school='', dn='cn=ucsschool,Object exists. cn=groups,dc=autotest201,dc=local') Resetting share file servers from None to None and None Traceback (most recent call last): File "04_ucs-school-reset-password-check", line 106, in <module> sys.exit(main()) File "04_ucs-school-reset-password-check", line 66, in main schoolName, oudn = schoolenv.create_ou(name_edudc=host) File "/usr/lib/pymodules/python2.7/univention/testing/ucsschool.py", line 264, in create_ou result = School(**kwargs).create(lo) File "/usr/lib/pymodules/python2.7/ucsschool/lib/models/base.py", line 365, in create success = self.create_without_hooks(lo, validate) File "/usr/lib/pymodules/python2.7/ucsschool/lib/models/school.py", line 340, in create_without_hooks self.create_default_groups(lo) File "/usr/lib/pymodules/python2.7/ucsschool/lib/models/school.py", line 147, in create_default_groups group.create(lo) File "/usr/lib/pymodules/python2.7/ucsschool/lib/models/base.py", line 365, in create success = self.create_without_hooks(lo, validate) File "/usr/lib/pymodules/python2.7/ucsschool/lib/models/group.py", line 134, in create_without_hooks super_container_dn = container.create_in_container(super_container_dn, lo) File "/usr/lib/pymodules/python2.7/ucsschool/lib/models/misc.py", line 62, in create_in_container udm_obj.create() File "/usr/lib/pymodules/python2.7/univention/admin/handlers/__init__.py", line 352, in create return self._create() File "/usr/lib/pymodules/python2.7/univention/admin/handlers/__init__.py", line 788, in _create self.lo.add(self.dn, al) File "/usr/lib/pymodules/python2.7/univention/admin/uldap.py", line 402, in add raise univention.admin.uexceptions.ldapError, _err2str(msg) univention.admin.uexceptions.ldapError: LDAP Error Invalid DN syntax: invalid DN
@Dirk: do you have an idea, where the bug origin is and when it may be triggered?
(In reply to Sönke Schwardt-Krummrich from comment #1) > @Dirk: do you have an idea, where the bug origin is and when it may be > triggered? Yes, this is due to Bug#30088 ucs-school-lib/python/models/misc.py class OU(UCSSchoolHelperAbstractClass): def create_in_container(self, container, lo): ... except objectExists as e: return str(e) ... Was: 'cn=groups,dc=autotest201,dc=local' Is: 'Object exists. cn=groups,dc=autotest201,dc=local' => - return str(e) + return e.args[0]
(In reply to Dirk Wiesenthal from comment #2) > - return str(e) > + return e.args[0] hmm, why not just 'return udm_obj.dn'?
(In reply to Florian Best from comment #3) > (In reply to Dirk Wiesenthal from comment #2) > > - return str(e) > > + return e.args[0] > hmm, why not just 'return udm_obj.dn'? udm_obj.dn is not set as the udm_obj is new there. At least it was not set when I tested it.
(In reply to Dirk Wiesenthal from comment #4) > (In reply to Florian Best from comment #3) > > (In reply to Dirk Wiesenthal from comment #2) > > > - return str(e) > > > + return e.args[0] > > hmm, why not just 'return udm_obj.dn'? > > udm_obj.dn is not set as the udm_obj is new there. At least it was not set > when I tested it. No, objectExists can *only* be raised if the DN is set. See also Bug #42928. But exc.args[0] is also okay :)
This was only an interim problem when we changed __str__ of objectExists. I fixed the correct exception usage during Bug #42399. *** This bug has been marked as a duplicate of bug 42399 ***