Bug 37375 - invalid DN syntax is used for Creating Container when creating new OU
invalid DN syntax is used for Creating Container when creating new OU
Status: RESOLVED DUPLICATE of bug 42399
Product: UCS@school
Classification: Unclassified
Component: Ucsschool-lib
UCS@school 4.0
Other Linux
: P5 normal (vote)
: UCS@school 4.0.x
Assigned To: UCS@school maintainers
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-12-17 10:26 CET by Ammar Najjar
Modified: 2016-11-14 14:43 CET (History)
4 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):
Max CVSS v3 score:


Attachments
Full output. (5.63 KB, text/plain)
2014-12-17 10:26 CET, Ammar Najjar
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ammar Najjar univentionstaff 2014-12-17 10:26:58 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
Comment 1 Sönke Schwardt-Krummrich univentionstaff 2015-01-05 09:50:19 CET
@Dirk: do you have an idea, where the bug origin is and when it may be triggered?
Comment 2 Dirk Wiesenthal univentionstaff 2015-01-05 10:55:03 CET
(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]
Comment 3 Florian Best univentionstaff 2015-01-21 17:23:17 CET
(In reply to Dirk Wiesenthal from comment #2)
> - return str(e)
> + return e.args[0]
hmm, why not just 'return udm_obj.dn'?
Comment 4 Dirk Wiesenthal univentionstaff 2015-01-21 17:44:05 CET
(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.
Comment 5 Florian Best univentionstaff 2016-11-14 14:37:58 CET
(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 :)
Comment 6 Florian Best univentionstaff 2016-11-14 14:43:39 CET
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 ***