Bug 30251 - district mode
district mode
Status: CLOSED FIXED
Product: UCS@school
Classification: Unclassified
Component: General
UCS@school 3.1
Other Linux
: P5 normal (vote)
: UCS@school 3.1 R2
Assigned To: Florian Best
Felix Botner
: interim-2
: 15078 (view as bug list)
Depends on:
Blocks: 31407 32031
  Show dependency treegraph
 
Reported: 2013-02-01 13:33 CET by Sönke Schwardt-Krummrich
Modified: 2013-07-22 11:25 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):
Max CVSS v3 score:


Attachments
Patch to enable the district mode in UMC (5.24 KB, patch)
2013-05-15 11:43 CEST, Alexander Kläser
Details | Diff
district.patch (6.24 KB, patch)
2013-05-21 11:53 CEST, Florian Best
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sönke Schwardt-Krummrich univentionstaff 2013-02-01 13:33:22 CET
UCS@school's district mode has to be tested intensively.
Comment 1 Sönke Schwardt-Krummrich univentionstaff 2013-03-20 12:03:33 CET
*** Bug 15078 has been marked as a duplicate of this bug. ***
Comment 2 Jascha Geerds univentionstaff 2013-05-08 11:47:40 CEST
The basic problem seems to be the following traceback, which occurs in nearly every UMC module. This bug needs to be fixed before any other module tests can be done:

---
Execution of command 'distribution/groups' has failed:

Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/__init__.py", line 204, in execute
    func( request )
  File "/usr/lib/pymodules/python2.6/ucsschool/lib/schoolldap.py", line 218, in wrapper_func
    raise LDAP_ConnectionError( str( e ) )
LDAP_ConnectionError: No such object
---
Comment 3 Florian Best univentionstaff 2013-05-08 12:07:24 CEST
to debug:
ucr set ldap/debug/level=4
tail -f /var/log/syslog
Comment 4 Sönke Schwardt-Krummrich univentionstaff 2013-05-14 13:49:55 CEST
Is there a quick solution for the OU detection possible?
OUs may be detected via objectClass "ucsschoolOrganizationalUnit".
Comment 5 Alexander Kläser univentionstaff 2013-05-15 10:45:10 CEST
(In reply to comment #4)
> Is there a quick solution for the OU detection possible?
> OUs may be detected via objectClass "ucsschoolOrganizationalUnit".

That should be a very good idea! I will have a look at it.
Comment 6 Alexander Kläser univentionstaff 2013-05-15 11:43:50 CEST
Created attachment 5226 [details]
Patch to enable the district mode in UMC

The attached patch should enable the usage of district mode in UMC. After applying the patch, I could log in as Administrator and teacher. The list of schools was displayed correctly, and the modules I tested were fine.

Basically, I changed the type SearchBaseSchool.availableSchools to be a dict of OU-DN pairs instead a list of OUs. One little adjustment was necessary in the computer room module. Otherwise, I could not see any other part that would specifically work with the availableSchools property.
Comment 7 Alexander Kläser univentionstaff 2013-05-15 11:44:40 CEST
Note, I left the old handling of OUs as fallback in case the objectClass is not set correctly.
Comment 8 Alexander Kläser univentionstaff 2013-05-17 19:56:41 CEST
As discussed, I applied the patch, packages are building.


ucs-school-umc-computerroom (3.0.1-0) unstable; urgency=low
.
  * Bug #30251: adjustments to enable the district mode


ucs-school-lib (3.0.1-0) unstable; urgency=low
.
  * Bug #30251: adjustments to enable the district mode
Comment 9 Alexander Kläser univentionstaff 2013-05-17 21:04:11 CEST
Probably a side effect:

> Traceback (most recent call last):
>  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/__init__.py", line 204, in execute
>     func( request )
>   File "/usr/lib/pymodules/python2.6/ucsschool/lib/schoolldap.py", line 195, in wrapper_func
>     _init_search_base( read_connection )
>   File "/usr/lib/pymodules/python2.6/ucsschool/lib/schoolldap.py", line 333, in _init_search_base
>     _search_base = SchoolSearchBase({})
>   File "/usr/lib/pymodules/python2.6/ucsschool/lib/schoolldap.py", line 351, in __init__
>     self._school = school or availableSchools.keys()[0]
> IndexError: list index out of range
Comment 10 Alexander Kläser univentionstaff 2013-05-17 21:05:00 CEST
(In reply to comment #9)
> Probably a side effect:
> ...

Happened in multi server scenario, when trying to create the first OU with the wizard module on the master.
Comment 11 Alexander Kläser univentionstaff 2013-05-17 21:10:19 CEST
(In reply to comment #10)
> (In reply to comment #9)
> > Probably a side effect:
> > ...
> 
> Happened in multi server scenario, when trying to create the first OU with the
> wizard module on the master.

Fixed:

ucs-school-lib (3.0.2-0) unstable; urgency=low
.
  * Bug #30251: fixed traceback when no school OUs exist
Comment 12 Alexander Kläser univentionstaff 2013-05-17 21:43:49 CEST
Another one in the installer:

> Traceback (most recent call last):
>   File "/usr/lib/pymodules/python2.6/univention/management/console/modules/__init__.py", line 204, in execute
>     func( request )
>   File "/usr/lib/pymodules/python2.6/univention/management/console/modules/decorators.py", line 176, in _response
>     return function(self, request)
>   File "/usr/lib/pymodules/python2.6/univention/management/console/modules/schoolinstaller/__init__.py", line 569, in install
>     searchBase = SchoolSearchBase([schoolOU], ldapBase=ucrMaster.get('ldap/base'))
>   File "/usr/lib/pymodules/python2.6/ucsschool/lib/schoolldap.py", line 353, in __init__
>     self._school = availableSchools.keys()[0]
> AttributeError: 'list' object has no attribute 'keys'

fixed in:

ucs-school-umc-installer (1.0.1-0) unstable; urgency=low
.
  * Bug #30251: adjustments to enable the district mode
Comment 13 Florian Best univentionstaff 2013-05-21 10:46:35 CEST
svn rev40636 breaks room selection for non-district mode.

The change was:
-               for ischool in search_base.availableSchools:
-                       if ('ou=%s' % ischool) in roomParts:
+               for ischool, ischoolDN in search_base.availableSchools.iteritems():
+                       if ischoolDN in roomParts:

 ( ERROR   ) : Failed to find corresponding school OU for room "cn=fooschool-raum1,cn=raeume,cn=groups,ou=fooschool,dc=ucs,dc=school" in list of schools ({'fooschool': 'ou=fooschool,dc=ucs,dc=school'})
Comment 14 Sönke Schwardt-Krummrich univentionstaff 2013-05-21 10:55:56 CEST
I think these changes produce too much side effects at the moment. Please revert all changes done for this bug and attach a patch for later integration.
Comment 15 Florian Best univentionstaff 2013-05-21 11:53:10 CEST
Created attachment 5230 [details]
district.patch

(In reply to comment #14)
> I think these changes produce too much side effects at the moment. Please
> revert all changes done for this bug and attach a patch for later integration.

Ok, the patch contains all made changes.

It needs to be adapted at least for the computerroom module.

Also a typo:
s/,  ):/ ):/

and the 'if len(foo)' can be replaced by 'if foo'
Comment 16 Florian Best univentionstaff 2013-05-21 12:01:18 CEST
The changes have been reverted and the packages have been built.
Comment 17 Alexander Kläser univentionstaff 2013-05-22 12:35:39 CEST
(In reply to comment #13)
> svn rev40636 breaks room selection for non-district mode.
> 
> The change was:
> -               for ischool in search_base.availableSchools:
> -                       if ('ou=%s' % ischool) in roomParts:
> +               for ischool, ischoolDN in
> search_base.availableSchools.iteritems():
> +                       if ischoolDN in roomParts:
> 
>  ( ERROR   ) : Failed to find corresponding school OU for room
> "cn=fooschool-raum1,cn=raeume,cn=groups,ou=fooschool,dc=ucs,dc=school" in list
> of schools ({'fooschool': 'ou=fooschool,dc=ucs,dc=school'})

→ this should be then "if ischoolDN in roomDN:" instead of "... in roomParts:".
Comment 18 Felix Botner univentionstaff 2013-05-23 12:13:28 CEST
OK, all changes have been reverted.
Comment 19 Sönke Schwardt-Krummrich univentionstaff 2013-06-07 21:40:24 CEST
UCS@school 3.1 R2 has been released:
http://download.univention.de/doc/release-notes-ucsschool-3.1-rev2.pdf

If this error occurs again, please use "Clone This Bug".