Bug 42251 - handle users having working groups but no class groups
handle users having working groups but no class groups
Status: CLOSED FIXED
Product: UCS@school
Classification: Unclassified
Component: Ucsschool-lib
UCS@school 4.1 R2
Other Linux
: P5 critical (vote)
: UCS@school 4.1 R2 vXXX
Assigned To: Daniel Tröder
Florian Best
: interim-1
Depends on: 41907 42495
Blocks:
  Show dependency treegraph
 
Reported: 2016-09-05 14:15 CEST by Daniel Tröder
Modified: 2016-10-04 13:24 CEST (History)
3 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 5: Major Usability: Impairs usability in key scenarios
Who will be affected by this bug?: 4: Will affect most installed domains
How will those affected feel about the bug?: 3: A User would likely not purchase the product
User Pain: 0.343
Enterprise Customer affected?:
School Customer affected?: Yes
ISV affected?:
Waiting Support:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Tröder univentionstaff 2016-09-05 14:15:24 CEST
handle users having working groups but no class groups

+++ This bug was initially created as a clone of Bug #41907 +++

Fixing Bug #41907, a regression was introduced in User.do_modify() in the case where a user is a member of more than one school, and in its non-primary OU is not part of a class, but of a working group.
Comment 1 Daniel Tröder univentionstaff 2016-09-05 14:20:26 CEST
72251: code
72252: advisory
Comment 2 Daniel Tröder univentionstaff 2016-09-05 16:20:37 CEST
The regression did surface when running test_modify_with_several_groups() of 90_ucsschool/34_import-users_via_cli_v2:

1) A user is part of two OUs: ou_A and ou_B.
2) The user is imported with various groups, relevant for us: a work group (workgroup_A, workgroup_B) and a class (class_A, class_B) in each OU.
3) In a second import the class of ou_B (class_B) is removed, only workgroup_B is kept.
4) During the import a KeyError occurs:

def do_modify(self, udm_obj, lo):
  for group_dn in udm_obj['groups'][:]:
    if school_group.self_is_class():
      classes = self.school_classes[school_group.school]

The problem is, that 'school_group' here is a work group, and the key 'school_group.school' does not exist in self.school_classes, as class_B was removed.

... now that I look at it, that is strange: school_group.self_is_class() should not have become True... I will revert locally and retry...
Comment 3 Daniel Tröder univentionstaff 2016-09-05 17:10:22 CEST
Hmm.. the test is unstable: 1st time I ran it with the old code it went through with no error, the 2nd time it crashed with the traceback that lead to this bug:


DEBUG: test_modify_with_several_groups:1072: *** Creating groups...
Creating groups/group object with /usr/sbin/udm-test groups/group create --position cn=groups,dc=uni,dc=dtr --set name=itivrwl2ul
Creating groups/group object with /usr/sbin/udm-test groups/group create --position cn=schueler,cn=groups,ou=dwv32vedqwri,dc=uni,dc=dtr --set name=dwv32vedqwri-kqfn032qeq
Creating groups/group object with /usr/sbin/udm-test groups/group create --position cn=klassen,cn=schueler,cn=groups,ou=dwv32vedqwri,dc=uni,dc=dtr --set name=dwv32vedqwri-k86t3x10og
Creating container/cn object with /usr/sbin/udm-test container/cn create --position ou=dwv32vedqwri,dc=uni,dc=dtr --set name=kurs-jsagqq9ftj
Creating groups/group object with /usr/sbin/udm-test groups/group create --position cn=kurs-jsagqq9ftj,ou=dwv32vedqwri,dc=uni,dc=dtr --set name=m52v2b079m
Creating groups/group object with /usr/sbin/udm-test groups/group create --position cn=kurs-jsagqq9ftj,ou=dwv32vedqwri,dc=uni,dc=dtr --set name=dwv32vedqwri-flfp788lik
Creating groups/group object with /usr/sbin/udm-test groups/group create --position cn=schueler,cn=groups,ou=p2g8q1wrdd,dc=uni,dc=dtr --set name=p2g8q1wrdd-nmuugawdlu
Creating groups/group object with /usr/sbin/udm-test groups/group create --position cn=klassen,cn=schueler,cn=groups,ou=p2g8q1wrdd,dc=uni,dc=dtr --set name=p2g8q1wrdd-k8vk4fa7rz
Creating container/cn object with /usr/sbin/udm-test container/cn create --position ou=p2g8q1wrdd,dc=uni,dc=dtr --set name=kurs-3xrmq8rtzl
Creating groups/group object with /usr/sbin/udm-test groups/group create --position cn=kurs-3xrmq8rtzl,ou=p2g8q1wrdd,dc=uni,dc=dtr --set name=rtxvywpl5d
Creating groups/group object with /usr/sbin/udm-test groups/group create --position cn=kurs-3xrmq8rtzl,ou=p2g8q1wrdd,dc=uni,dc=dtr --set name=p2g8q1wrdd-um3ldzu66j
INFO: test_modify_with_several_groups:1099: *** Importing a new single user with role 'student'
DEBUG: create_csv_file:251: Header row = ['Nach', 'OUs', 'E-Mail', 'Vor', 'Gruppen', 'Beschreibung']
DEBUG: create_csv_file:264: Person data = {'E-Mail': 'h284r2ipwk@uni.dtr', 'Gruppen': 'p2g8q1wrdd-k8vk4fa7rz,dwv32vedqwri-40ly,dwv32vedqwri-k86t3x10og', 'Vor': 'cznzpe5waj', 'OUs': 'dwv32vedqwri,p2g8q1wrdd', 'Nach': 'n1ph1rdmsj', 'Beschreibung': None}
########## [..] ##########
2016-09-05 16:28:29 INFO  user_import.read_input:74  ------ Starting to read users from input data... ------
2016-09-05 16:28:29 DEBUG base_reader.next:72  Input 2: ['n1ph1rdmsj', 'dwv32vedqwri,p2g8q1wrdd', 'h284r2ipwk@uni.dtr', 'cznzpe5waj', 'p2g8q1wrdd-k8vk4fa7rz,dwv32vedqwri-40ly,dwv32vedqwri-k86t3x10og', ''] -> {u'Gruppen': u'p2g8q1wrdd-k8vk4fa7rz,dwv32vedqwri-40ly,dwv32vedqwri-k86t3x10og', u'Nach': u'n1ph1rdmsj', u'Beschreibung': u'', u'E-Mail': u'h284r2ipwk@uni.dtr', u'Vor': u'cznzpe5waj', u'OUs': u'dwv32vedqwri,p2g8q1wrdd'}
########## [..] ##########
2016-09-05 16:28:29 INFO  user_import.create_and_modify_users:121  Adding ImportStudent(name='c.n1ph1rdmsj', school='dwv32vedqwri', dn='uid=c.n1ph1rdmsj,cn=schueler,cn=users,ou=dwv32vedqwri,dc=uni,dc=dtr', old_dn=None) (source_uid:sourceUID-nbc7g94jpb record_uid:cznzpe5waj;n1ph1rdmsj;h284r2ipwk@uni.dtr) attributes={'$dn$': 'uid=c.n1ph1rdmsj,cn=schueler,cn=users,ou=dwv32vedqwri,dc=uni,dc=dtr', 'display_name': 'cznzpe5waj n1ph1rdmsj', 'record_uid': u'cznzpe5waj;n1ph1rdmsj;h284r2ipwk@uni.dtr', 'firstname': 'cznzpe5waj', 'lastname': 'n1ph1rdmsj', 'type_name': 'Student', 'school': 'dwv32vedqwri', 'name': 'c.n1ph1rdmsj', 'disabled': 'none', 'email': u'h284r2ipwk@uni.dtr', 'birthday': None, 'type': 'importStudent', 'schools': ['dwv32vedqwri', 'p2g8q1wrdd'], 'password': 'doU6(-Uukh(e&.K', 'source_uid': u'sourceUID-nbc7g94jpb', 'school_classes': {'p2g8q1wrdd': ['p2g8q1wrdd-k8vk4fa7rz'], 'dwv32vedqwri': ['dwv32vedqwri-40ly', 'dwv32vedqwri-k86t3x10og']}, 'objectType': 'users/user'} udm_properties={'overridePWHistory': '1', u'description': u'', 'overridePWLength': '1'}...
########## [..] ##########
2016-09-05 16:28:30 INFO  user_import.log_stats:372  Created ImportStudent: 1
2016-09-05 16:28:30 INFO  user_import.log_stats:374    ['c.n1ph1rdmsj']
########## [..] ##########

INFO: test_modify_with_several_groups:1136: *** Adding user with role 'student' to groups
Modifying groups/group object with /usr/sbin/udm-test groups/group modify --dn cn=itivrwl2ul,cn=groups,dc=uni,dc=dtr --append users=uid=c.n1ph1rdmsj,cn=schueler,cn=users,ou=dwv32vedqwri,dc=uni,dc=dtr
. . . . . . . . . . . . . . . . . . . . . . . . . . . . Modifying groups/group object with /usr/sbin/udm-test groups/group modify --dn cn=dwv32vedqwri-kqfn032qeq,cn=schueler,cn=groups,ou=dwv32vedqwri,dc=uni,dc=dtr --append users=uid=c.n1ph1rdmsj,cn=schueler,cn=users,ou=dwv32vedqwri,dc=uni,dc=dtr
Modifying groups/group object with /usr/sbin/udm-test groups/group modify --dn cn=p2g8q1wrdd-nmuugawdlu,cn=schueler,cn=groups,ou=p2g8q1wrdd,dc=uni,dc=dtr --append users=uid=c.n1ph1rdmsj,cn=schueler,cn=users,ou=dwv32vedqwri,dc=uni,dc=dtr
Modifying groups/group object with /usr/sbin/udm-test groups/group modify --dn cn=m52v2b079m,cn=kurs-jsagqq9ftj,ou=dwv32vedqwri,dc=uni,dc=dtr --append users=uid=c.n1ph1rdmsj,cn=schueler,cn=users,ou=dwv32vedqwri,dc=uni,dc=dtr
Modifying groups/group object with /usr/sbin/udm-test groups/group modify --dn cn=dwv32vedqwri-flfp788lik,cn=kurs-jsagqq9ftj,ou=dwv32vedqwri,dc=uni,dc=dtr --append users=uid=c.n1ph1rdmsj,cn=schueler,cn=users,ou=dwv32vedqwri,dc=uni,dc=dtr
Modifying groups/group object with /usr/sbin/udm-test groups/group modify --dn cn=rtxvywpl5d,cn=kurs-3xrmq8rtzl,ou=p2g8q1wrdd,dc=uni,dc=dtr --append users=uid=c.n1ph1rdmsj,cn=schueler,cn=users,ou=dwv32vedqwri,dc=uni,dc=dtr
Modifying groups/group object with /usr/sbin/udm-test groups/group modify --dn cn=p2g8q1wrdd-um3ldzu66j,cn=kurs-3xrmq8rtzl,ou=p2g8q1wrdd,dc=uni,dc=dtr --append users=uid=c.n1ph1rdmsj,cn=schueler,cn=users,ou=dwv32vedqwri,dc=uni,dc=dtr
** Entering verify_ldap_object
** Exiting verify_ldap_object
** Entering verify_ldap_object
** Exiting verify_ldap_object
** Entering verify_ldap_object
** Exiting verify_ldap_object
** Entering verify_ldap_object
** Exiting verify_ldap_object
** Entering verify_ldap_object
** Exiting verify_ldap_object
** Entering verify_ldap_object
** Exiting verify_ldap_object
** Entering verify_ldap_object
** Exiting verify_ldap_object
INFO: test_modify_with_several_groups:1154: *** Modifying a single user with role 'student'
DEBUG: create_csv_file:251: Header row = ['Gruppen', 'Nach', 'Beschreibung', 'Vor', 'E-Mail', 'OUs']
DEBUG: create_csv_file:264: Person data = {'E-Mail': 'h284r2ipwk@uni.dtr', 'Gruppen': 'dwv32vedqwri-52gs,dwv32vedqwri-k86t3x10og', 'Vor': 'cznzpe5waj', 'OUs': 'dwv32vedqwri,p2g8q1wrdd', 'Nach': 'n1ph1rdmsj', 'Beschreibung': None}
DEBUG: save_ldap_status:269: Saving LDAP status...
DEBUG: save_ldap_status:271: LDAP status saved.
INFO: run_import:285: Starting import: ['/usr/share/ucs-school-import/scripts/ucs-school-user-import', '-c', '/tmp/34_import-users_via_cli_v2.hkSm63/config.jYKKmI']
To change the loglevel, set UCRV ucsschool/logging/level/importer.
------ UCS@school import tool starting ------
Reading configuration from '/usr/share/ucs-school-import/configs/global_defaults.json'...
Reading configuration from '/var/lib/ucs-school-import/configs/global.json'...
Reading configuration from '/usr/share/ucs-school-import/configs/user_import_defaults.json'...
Reading configuration from '/var/lib/ucs-school-import/configs/user_import.json'...
Reading configuration from '/tmp/34_import-users_via_cli_v2.hkSm63/config.jYKKmI'...
2016-09-05 16:29:03 INFO  cmdline.setup_logging:67  To change the loglevel, set UCRV ucsschool/logging/level/importer.
2016-09-05 16:29:03 INFO  cmdline.main:111  ------ UCS@school import tool configured ------
2016-09-05 16:29:03 INFO  cmdline.main:112  Used configuration files: ['/usr/share/ucs-school-import/configs/global_defaults.json', '/var/lib/ucs-school-import/configs/global.json', '/usr/share/ucs-school-import/configs/user_import_defaults.json', '/var/lib/ucs-school-import/configs/user_import.json', '/tmp/34_import-users_via_cli_v2.hkSm63/config.jYKKmI'].
2016-09-05 16:29:03 INFO  cmdline.main:113  Using command line arguments: {}
2016-09-05 16:29:03 INFO  cmdline.main:114  Configuration is:
{u'activate_new_users': {u'default': True},
 u'classes': {},
 u'csv': {u'header_lines': 1,
          u'incell-delimiter': {u'default': u','},
          u'mapping': {u'Beschreibung': u'description',
                       u'E-Mail': u'email',
                       u'Gruppen': u'school_classes',
                       u'Nach': u'lastname',
                       u'OUs': u'schools',
                       u'Vor': u'firstname'}},
 u'dry_run': False,
 u'factory': u'ucsschool.importer.default_user_import_factory.DefaultUserImportFactory',
 u'input': {u'filename': u'/tmp/34_import-users_via_cli_v2.hkSm63/users.atTwul',
            u'type': u'csv'},
 u'logfile': u'/var/log/univention/ucs-school-import.log',
 u'maildomain': u'example.com',
 u'mandatory_attributes': [u'firstname', u'lastname', u'name', u'school'],
 u'no_delete': False,
 u'output': {u'new_user_passwords': None,
             u'user_import_summary': u'/var/lib/ucs-school-import/user_import_summary_%Y-%m-%d_%H:%M:%S.csv'},
 u'password_length': 15,
 u'scheme': {u'email': u'<firstname>[0].<lastname>@<maildomain>',
             u'recordUID': u'<firstname>;<lastname>;<email>',
             u'username': {u'allow_rename': False,
                           u'default': u'<:umlauts><firstname>[0].<lastname>[COUNTER2]'}},
 u'school': None,
 u'sourceUID': u'sourceUID-nbc7g94jpb',
 u'tolerate_errors': 0,
 u'user_deletion': {u'delete': True, u'expiration': 0},
 u'user_role': u'student',
 u'verbose': True}
2016-09-05 16:29:03 INFO  cmdline.do_import:94  ------ Starting mass import... ------
2016-09-05 16:29:03 WARNING utils.stopped_notifier:294  Stopping univention-directory-notifier
2016-09-05 16:29:09 INFO  utils._run:288  Stopping univention-directory-notifier daemon: .
ok: down: univention-directory-notifier: 1s
done.

2016-09-05 16:29:09 INFO  utils.stopped_notifier:306  univention-directory-notifier stopped
2016-09-05 16:29:09 INFO  mass_import.import_users:93  ------ Importing users... ------
2016-09-05 16:29:09 INFO  user_import.read_input:74  ------ Starting to read users from input data... ------
2016-09-05 16:29:09 DEBUG base_reader.next:72  Input 2: ['dwv32vedqwri-52gs,dwv32vedqwri-k86t3x10og', 'n1ph1rdmsj', '', 'cznzpe5waj', 'h284r2ipwk@uni.dtr', 'dwv32vedqwri,p2g8q1wrdd'] -> {u'Gruppen': u'dwv32vedqwri-52gs,dwv32vedqwri-k86t3x10og', u'Nach': u'n1ph1rdmsj', u'Beschreibung': u'', u'E-Mail': u'h284r2ipwk@uni.dtr', u'Vor': u'cznzpe5waj', u'OUs': u'dwv32vedqwri,p2g8q1wrdd'}
2016-09-05 16:29:09 DEBUG base.cache:209  Initializing ('SchoolClass', ('name', 'dwv32vedqwri-52gs'), ('school', 'dwv32vedqwri'))
2016-09-05 16:29:09 DEBUG base.cache:209  Initializing ('SchoolClass', ('name', 'dwv32vedqwri-k86t3x10og'), ('school', 'dwv32vedqwri'))
2016-09-05 16:29:09 DEBUG csv_reader.map:194  ImportStudent(name=None, school=None, dn=None) attributes={'$dn$': None, 'display_name': u'cznzpe5waj n1ph1rdmsj', 'record_uid': None, 'firstname': u'cznzpe5waj', 'lastname': u'n1ph1rdmsj', 'type_name': 'Student', 'school': None, 'name': None, 'disabled': None, 'email': u'h284r2ipwk@uni.dtr', 'birthday': None, 'type': 'importStudent', 'schools': u'dwv32vedqwri,p2g8q1wrdd', 'password': None, 'source_uid': None, 'school_classes': {'dwv32vedqwri': ['dwv32vedqwri-52gs', 'dwv32vedqwri-k86t3x10og']}, 'objectType': 'users/user'} udm_properties={u'description': u''} action=None
2016-09-05 16:29:09 INFO  user_import.read_input:78  Done reading 1. user: ImportStudent(name=None, school=None, dn=None)
2016-09-05 16:29:09 INFO  user_import.read_input:86  ------ Read 1 users from input data. ------
2016-09-05 16:29:09 INFO  user_import.detect_users_to_delete:206  ------ Detecting which users to delete... ------
2016-09-05 16:29:09 DEBUG user_import.detect_users_to_delete:248  users_to_delete=[]
2016-09-05 16:29:09 INFO  user_import.delete_users:263  ------ Deleting 0 users... ------
2016-09-05 16:29:09 INFO  user_import.delete_users:278  ------ Deleted 0 users. ------
2016-09-05 16:29:09 INFO  user_import.create_and_modify_users:100  ------ Creating / modifying users... ------
2016-09-05 16:29:09 DEBUG user_import.create_and_modify_users:105  Creating / modifying user ImportStudent(name=None, school=None, dn=None)...
2016-09-05 16:29:09 DEBUG base.get_only_udm_obj:859  Getting ImportStudent UDM object by filter: (&(objectClass=ucsschoolType)(ucsschoolSourceUID=sourceUID-nbc7g94jpb)(ucsschoolRecordUID=cznzpe5waj;n1ph1rdmsj;h284r2ipwk@uni.dtr))
2016-09-05 16:29:09 INFO  user_import.create_and_modify_users:121  Modifying ImportStudent(name='c.n1ph1rdmsj', school='dwv32vedqwri', dn='uid=c.n1ph1rdmsj,cn=schueler,cn=users,ou=dwv32vedqwri,dc=uni,dc=dtr') (source_uid:sourceUID-nbc7g94jpb record_uid:cznzpe5waj;n1ph1rdmsj;h284r2ipwk@uni.dtr) attributes={'$dn$': 'uid=c.n1ph1rdmsj,cn=schueler,cn=users,ou=dwv32vedqwri,dc=uni,dc=dtr', 'display_name': 'cznzpe5waj n1ph1rdmsj', 'record_uid': u'cznzpe5waj;n1ph1rdmsj;h284r2ipwk@uni.dtr', 'firstname': 'cznzpe5waj', 'lastname': 'n1ph1rdmsj', 'type_name': 'Student', 'school': 'dwv32vedqwri', 'name': 'c.n1ph1rdmsj', 'disabled': 'none', 'email': u'h284r2ipwk@uni.dtr', 'birthday': None, 'type': 'importStudent', 'schools': ['dwv32vedqwri', 'p2g8q1wrdd'], 'password': None, 'source_uid': u'sourceUID-nbc7g94jpb', 'school_classes': {'dwv32vedqwri': ['dwv32vedqwri-52gs', 'dwv32vedqwri-k86t3x10og']}, 'objectType': 'users/user'} udm_properties={u'description': u''}...
2016-09-05 16:29:09 INFO  pyhooks_loader.get_plugins:52  Searching for plugins in: /usr/share/ucs-school-import/pyhooks...
2016-09-05 16:29:09 INFO  pyhooks_loader.get_plugins:60  Found plugins: []
2016-09-05 16:29:09 INFO  import_user.setup_pyhooks:725  Registered hooks: {}.
2016-09-05 16:29:09 DEBUG base.call_hooks:363  /usr/share/ucs-school-import/hooks/user_modify_pre.d not found or empty.
2016-09-05 16:29:09 INFO  base.modify_without_hooks:477  Modifying ImportStudent(name='c.n1ph1rdmsj', school='dwv32vedqwri', dn='uid=c.n1ph1rdmsj,cn=schueler,cn=users,ou=dwv32vedqwri,dc=uni,dc=dtr')
2016-09-05 16:29:09 DEBUG base.cache:209  Initializing ('School', ('name', 'dwv32vedqwri'))
2016-09-05 16:29:09 DEBUG base.get_udm_object:656  Getting School UDM object by dn: ou=dwv32vedqwri,dc=uni,dc=dtr
2016-09-05 16:29:09 DEBUG base.get_only_udm_obj:859  Getting ImportStudent UDM object by filter: &(!(uid=c.n1ph1rdmsj))(mailPrimaryAddress=h284r2ipwk@uni.dtr)
2016-09-05 16:29:09 DEBUG base.cache:209  Initializing ('MailDomain', ('name', u'uni.dtr'))
2016-09-05 16:29:09 DEBUG base.get_udm_object:656  Getting MailDomain UDM object by dn: cn=uni.dtr,cn=domain,cn=mail,dc=uni,dc=dtr
2016-09-05 16:29:09 DEBUG base.cache:209  Initializing ('Group', ('name', 'Domain Users dwv32vedqwri'), ('school', 'dwv32vedqwri'))
2016-09-05 16:29:09 DEBUG base.cache:209  Initializing ('Group', ('name', 'Domain Users p2g8q1wrdd'), ('school', 'p2g8q1wrdd'))
2016-09-05 16:29:09 DEBUG base.cache:209  Initializing ('Group', ('name', 'schueler-dwv32vedqwri'), ('school', 'dwv32vedqwri'))
2016-09-05 16:29:09 DEBUG base.cache:209  Initializing ('Group', ('name', 'schueler-p2g8q1wrdd'), ('school', 'p2g8q1wrdd'))
2016-09-05 16:29:09 DEBUG base.call_hooks:363  /usr/share/ucs-school-import/hooks/group_create_pre.d not found or empty.
2016-09-05 16:29:09 DEBUG base.get_only_udm_obj:859  Getting Group UDM object by filter: name=Domain Users dwv32vedqwri
2016-09-05 16:29:09 DEBUG base.get_only_udm_obj:859  Getting Group UDM object by filter: name=Domain Users p2g8q1wrdd
2016-09-05 16:29:09 DEBUG base.get_only_udm_obj:859  Getting SchoolClass UDM object by filter: name=dwv32vedqwri-52gs
2016-09-05 16:29:09 INFO  base.create_without_hooks:425  Creating SchoolClass(name='dwv32vedqwri-52gs', school='dwv32vedqwri', dn='cn=dwv32vedqwri-52gs,cn=klassen,cn=schueler,cn=groups,ou=dwv32vedqwri,dc=uni,dc=dtr')
2016-09-05 16:29:09 INFO  base.create_without_hooks:447  SchoolClass(name='dwv32vedqwri-52gs', school='dwv32vedqwri', dn='cn=dwv32vedqwri-52gs,cn=klassen,cn=schueler,cn=groups,ou=dwv32vedqwri,dc=uni,dc=dtr') successfully created
2016-09-05 16:29:09 DEBUG base.invalidate_cache:230  Invalidating ('SchoolClass', ('name', 'dwv32vedqwri-52gs'), ('school', 'dwv32vedqwri'))
2016-09-05 16:29:09 DEBUG base.invalidate_cache:230  Invalidating ('SchoolClass', ('name', 'dwv32vedqwri-k86t3x10og'), ('school', 'dwv32vedqwri'))
2016-09-05 16:29:09 DEBUG base.get_only_udm_obj:859  Getting SchoolClass UDM object by filter: name=dwv32vedqwri-52gs
2016-09-05 16:29:09 DEBUG base.get_udm_object:656  Getting ClassShare UDM object by dn: cn=dwv32vedqwri-52gs,cn=klassen,cn=shares,ou=dwv32vedqwri,dc=uni,dc=dtr
2016-09-05 16:29:09 DEBUG base.call_hooks:363  /usr/share/ucs-school-import/hooks/share_create_pre.d not found or empty.
2016-09-05 16:29:09 INFO  base.create_without_hooks:425  Creating ClassShare(name='dwv32vedqwri-52gs', school='dwv32vedqwri', dn='cn=dwv32vedqwri-52gs,cn=klassen,cn=shares,ou=dwv32vedqwri,dc=uni,dc=dtr')
2016-09-05 16:29:09 DEBUG base.from_dn:842  Looking up School with dn 'ou=dwv32vedqwri,dc=uni,dc=dtr'
2016-09-05 16:29:09 INFO  share.do_create:71  Creating share on "sch-m-71.uni.dtr"
2016-09-05 16:29:09 INFO  base.create_without_hooks:447  ClassShare(name='dwv32vedqwri-52gs', school='dwv32vedqwri', dn='cn=dwv32vedqwri-52gs,cn=klassen,cn=shares,ou=dwv32vedqwri,dc=uni,dc=dtr') successfully created
2016-09-05 16:29:09 DEBUG base.call_hooks:363  /usr/share/ucs-school-import/hooks/share_create_post.d not found or empty.
2016-09-05 16:29:09 DEBUG base.call_hooks:363  /usr/share/ucs-school-import/hooks/group_create_post.d not found or empty.
2016-09-05 16:29:09 DEBUG base.cache:209  Initializing ('SchoolClass', ('name', 'dwv32vedqwri-k86t3x10og'), ('school', 'dwv32vedqwri'))
2016-09-05 16:29:09 DEBUG base.get_only_udm_obj:859  Getting SchoolClass UDM object by filter: name=dwv32vedqwri-k86t3x10og
2016-09-05 16:29:09 DEBUG base.get_only_udm_obj:859  Getting Group UDM object by filter: name=schueler-dwv32vedqwri
2016-09-05 16:29:09 DEBUG base.get_only_udm_obj:859  Getting Group UDM object by filter: name=schueler-p2g8q1wrdd
2016-09-05 16:29:09 DEBUG user.do_modify:264  Checking group cn=schueler-dwv32vedqwri,cn=groups,ou=dwv32vedqwri,dc=uni,dc=dtr for removal
2016-09-05 16:29:09 DEBUG user.do_modify:264  Checking group cn=Domain Users dwv32vedqwri,cn=groups,ou=dwv32vedqwri,dc=uni,dc=dtr for removal
2016-09-05 16:29:09 DEBUG user.do_modify:264  Checking group cn=schueler-p2g8q1wrdd,cn=groups,ou=p2g8q1wrdd,dc=uni,dc=dtr for removal
2016-09-05 16:29:09 DEBUG user.do_modify:264  Checking group cn=Domain Users p2g8q1wrdd,cn=groups,ou=p2g8q1wrdd,dc=uni,dc=dtr for removal
2016-09-05 16:29:09 DEBUG user.do_modify:264  Checking group cn=itivrwl2ul,cn=groups,dc=uni,dc=dtr for removal
2016-09-05 16:29:09 DEBUG user.do_modify:266  Group not mandatory! Part of a school?
2016-09-05 16:29:09 WARNING base.from_dn:840  Unable to guess school from 'cn=itivrwl2ul,cn=groups,dc=uni,dc=dtr'
2016-09-05 16:29:09 DEBUG base.from_dn:842  Looking up Group with dn 'cn=itivrwl2ul,cn=groups,dc=uni,dc=dtr'
2016-09-05 16:29:09 DEBUG base.cache:209  Initializing ('School', ('name', None))
2016-09-05 16:29:09 DEBUG user.do_modify:281  Group is no school class or workgroup. Leave it untouched.
2016-09-05 16:29:09 DEBUG user.do_modify:264  Checking group cn=dwv32vedqwri-kqfn032qeq,cn=schueler,cn=groups,ou=dwv32vedqwri,dc=uni,dc=dtr for removal
2016-09-05 16:29:09 DEBUG user.do_modify:266  Group not mandatory! Part of a school?
2016-09-05 16:29:09 DEBUG base.from_dn:842  Looking up Group with dn 'cn=dwv32vedqwri-kqfn032qeq,cn=schueler,cn=groups,ou=dwv32vedqwri,dc=uni,dc=dtr'
2016-09-05 16:29:09 INFO  base.from_udm_obj:776  UDM object cn=dwv32vedqwri-kqfn032qeq,cn=schueler,cn=groups,ou=dwv32vedqwri,dc=uni,dc=dtr is not Group, but actually WorkGroup
2016-09-05 16:29:09 DEBUG user.do_modify:283  Yes, part of dwv32vedqwri!
2016-09-05 16:29:09 DEBUG user.do_modify:288  Leaving it alone: Part of own school and either non-school class or new school classes were not defined at all.
2016-09-05 16:29:09 DEBUG user.do_modify:264  Checking group cn=dwv32vedqwri-k86t3x10og,cn=klassen,cn=schueler,cn=groups,ou=dwv32vedqwri,dc=uni,dc=dtr for removal
2016-09-05 16:29:09 DEBUG user.do_modify:264  Checking group cn=m52v2b079m,cn=kurs-jsagqq9ftj,ou=dwv32vedqwri,dc=uni,dc=dtr for removal
2016-09-05 16:29:09 DEBUG user.do_modify:266  Group not mandatory! Part of a school?
2016-09-05 16:29:09 DEBUG base.from_dn:842  Looking up Group with dn 'cn=m52v2b079m,cn=kurs-jsagqq9ftj,ou=dwv32vedqwri,dc=uni,dc=dtr'
2016-09-05 16:29:09 DEBUG user.do_modify:281  Group is no school class or workgroup. Leave it untouched.
2016-09-05 16:29:09 DEBUG user.do_modify:264  Checking group cn=dwv32vedqwri-flfp788lik,cn=kurs-jsagqq9ftj,ou=dwv32vedqwri,dc=uni,dc=dtr for removal
2016-09-05 16:29:09 DEBUG user.do_modify:266  Group not mandatory! Part of a school?
2016-09-05 16:29:09 DEBUG base.from_dn:842  Looking up Group with dn 'cn=dwv32vedqwri-flfp788lik,cn=kurs-jsagqq9ftj,ou=dwv32vedqwri,dc=uni,dc=dtr'
2016-09-05 16:29:09 DEBUG user.do_modify:281  Group is no school class or workgroup. Leave it untouched.
2016-09-05 16:29:09 DEBUG user.do_modify:264  Checking group cn=p2g8q1wrdd-nmuugawdlu,cn=schueler,cn=groups,ou=p2g8q1wrdd,dc=uni,dc=dtr for removal
2016-09-05 16:29:09 DEBUG user.do_modify:266  Group not mandatory! Part of a school?
2016-09-05 16:29:09 DEBUG base.from_dn:842  Looking up Group with dn 'cn=p2g8q1wrdd-nmuugawdlu,cn=schueler,cn=groups,ou=p2g8q1wrdd,dc=uni,dc=dtr'
2016-09-05 16:29:09 INFO  base.from_udm_obj:776  UDM object cn=p2g8q1wrdd-nmuugawdlu,cn=schueler,cn=groups,ou=p2g8q1wrdd,dc=uni,dc=dtr is not Group, but actually WorkGroup
2016-09-05 16:29:09 DEBUG user.do_modify:283  Yes, part of p2g8q1wrdd!
2016-09-05 16:29:09 DEBUG user.do_modify:288  Leaving it alone: Part of own school and either non-school class or new school classes were not defined at all.
2016-09-05 16:29:09 DEBUG user.do_modify:264  Checking group cn=p2g8q1wrdd-k8vk4fa7rz,cn=klassen,cn=schueler,cn=groups,ou=p2g8q1wrdd,dc=uni,dc=dtr for removal
2016-09-05 16:29:09 DEBUG user.do_modify:266  Group not mandatory! Part of a school?
2016-09-05 16:29:09 DEBUG base.from_dn:842  Looking up Group with dn 'cn=p2g8q1wrdd-k8vk4fa7rz,cn=klassen,cn=schueler,cn=groups,ou=p2g8q1wrdd,dc=uni,dc=dtr'
2016-09-05 16:29:09 INFO  base.from_udm_obj:776  UDM object cn=p2g8q1wrdd-k8vk4fa7rz,cn=klassen,cn=schueler,cn=groups,ou=p2g8q1wrdd,dc=uni,dc=dtr is not Group, but actually SchoolClass
2016-09-05 16:29:09 WARNING utils.stopped_notifier:316  Starting univention-directory-notifier
2016-09-05 16:29:10 INFO  utils._run:288  Starting Univention Directory Notifier daemon.
ok: run: univention-directory-notifier: (pid 28191) 1s, normally down
done.

2016-09-05 16:29:10 INFO  utils.stopped_notifier:323  univention-directory-notifier started
2016-09-05 16:29:10 ERROR cmdline.main:137  Outer Exception catcher: KeyError('p2g8q1wrdd',)
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/ucsschool/importer/frontend/cmdline.py", line 117, in main
    self.do_import()
  File "/usr/lib/pymodules/python2.7/ucsschool/importer/frontend/cmdline.py", line 95, in do_import
    importer.mass_import()
  File "/usr/lib/pymodules/python2.7/ucsschool/importer/mass_import/mass_import.py", line 69, in mass_import
    self.import_users()
  File "/usr/lib/pymodules/python2.7/ucsschool/importer/mass_import/mass_import.py", line 98, in import_users
    user_import.create_and_modify_users(imported_users)
  File "/usr/lib/pymodules/python2.7/ucsschool/importer/mass_import/user_import.py", line 139, in create_and_modify_users
    success = user.modify(lo=self.connection)
  File "/usr/lib/pymodules/python2.7/ucsschool/importer/models/import_user.py", line 492, in modify
    return super(ImportUser, self).modify(lo, validate, move_if_necessary)
  File "/usr/lib/pymodules/python2.7/ucsschool/lib/models/base.py", line 471, in modify
    success = self.modify_without_hooks(lo, validate, move_if_necessary)
  File "/usr/lib/pymodules/python2.7/ucsschool/importer/models/import_user.py", line 498, in modify_without_hooks
    success = super(ImportUser, self).modify_without_hooks(lo, validate, move_if_necessary)
  File "/usr/lib/pymodules/python2.7/ucsschool/lib/models/base.py", line 494, in modify_without_hooks
    self.do_modify(udm_obj, lo)
  File "/usr/lib/pymodules/python2.7/ucsschool/lib/models/user.py", line 276, in do_modify
    classes = self.school_classes[school_group.school]
KeyError: 'p2g8q1wrdd'
INFO: run_import:289: Import process exited with exit code 1
ERROR: run_import:291: As requested raising an exception due to non-zero exit code
*** Cleanup after exception: <class '__main__.ImportException'> Non-zero exit code 1
Comment 4 Daniel Tröder univentionstaff 2016-09-15 09:42:34 CEST
I was not able to reproduce the problem from comment3 #c3, and it does not show up in jenkins tests. It was probably an error in my test environment.
Comment 5 Florian Best univentionstaff 2016-09-23 18:01:13 CEST
(In reply to Daniel Tröder from comment #4)
> I was not able to reproduce the problem from comment3 #c3, and it does not
> show up in jenkins tests. It was probably an error in my test environment.
This was because the old code was used.

>  File "/usr/lib/pymodules/python2.7/ucsschool/lib/models/user.py", line 276, in do_modify
>    classes = self.school_classes[school_group.school]

OK: this bug is just a regression from svn r71418
OK: YAML
Comment 6 Sönke Schwardt-Krummrich univentionstaff 2016-10-04 13:24:51 CEST
UCS@school 4.1 R2 v5 has been released.

http://docs.software-univention.de/changelog-ucsschool-4.1R2v5-de.html

If this error occurs again, please clone this bug.