Bug 41645 - Combination of <:lower> and [COUNTER2] not possible
Combination of <:lower> and [COUNTER2] not possible
Status: CLOSED FIXED
Product: UCS@school
Classification: Unclassified
Component: Import scripts
UCS@school 4.1 R2
Other Linux
: P5 normal (vote)
: UCS@school 4.1 R2 vXXX
Assigned To: Daniel Tröder
Sönke Schwardt-Krummrich
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2016-06-23 08:07 CEST by Jan Christoph Ebersbach
Modified: 2016-10-06 21:12 CEST (History)
3 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 3: Simply Wrong: The implementation doesn't match the docu
Who will be affected by this bug?: 2: Will only affect a few installed domains
How will those affected feel about the bug?: 2: A Pain – users won’t like this once they notice it
User Pain: 0.069
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

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Christoph Ebersbach univentionstaff 2016-06-23 08:07:57 CEST
For the import, I tried to generate lowercase user names with a counter in case the name is already in use.  My username configuration looks as follows (the whole configuration can be found at Bug #41642):

    "username": "<:lower><:umlauts><firstname>.<lastname>[0:2][COUNTER2]"

This results in the following error message.  It is therefore not possible to generate lowercase usernames with a counter which I find to be a major issue:

2016-06-15 16:43:44 DEBUG base.get_only_udm_obj:853  Getting ImportStudent UDM object by filter: (&(objectClass=ucsschoolType)(ucsschoolSourceUID=mydb)(ucsschoolRecordUID= 2001-11-03))
2016-06-15 16:43:44 ERROR user_import.create_and_modify_users:190  Entry #0: Unknown variable name '[counter2]' in username scheme 'elena.sc[counter2]': '[counter2]'
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/ucsschool/importer/mass_import/user_import.py", line 113, in create_and_modify_users
    user = self.determine_add_modify_action(imported_user)
  File "/usr/lib/pymodules/python2.7/ucsschool/importer/mass_import/user_import.py", line 224, in determine_add_modify_action
    imported_user.prepare_all(new_user=True)
  File "/usr/lib/pymodules/python2.7/ucsschool/importer/models/import_user.py", line 177, in prepare_all
    self.prepare_attributes(new_user)
  File "/usr/lib/pymodules/python2.7/ucsschool/importer/models/import_user.py", line 190, in prepare_attributes
    self.make_username()
  File "/usr/lib/pymodules/python2.7/ucsschool/importer/models/import_user.py", line 434, in make_username
    self.name = self.username_handler.format_username(self.name)
  File "/usr/lib/pymodules/python2.7/ucsschool/importer/utils/username_handler.py", line 91, in format_username
    variable, name)
FormatError: Unknown variable name '[counter2]' in username scheme 'elena.sc[counter2]': '[counter2]'
2016-06-15 16:43:44 WARNING utils.stopped_notifier:190  Starting univention-directory-notifier
2016-06-15 16:43:44 WARNING utils.stopped_notifier:192  Notifier was not running! Skipping
2016-06-15 16:43:44 ERROR cmdline.main:119  More than 0 errors. Exiting. Errors:
2016-06-15 16:43:44 ERROR cmdline.main:121  0: Unknown variable name '[counter2]' in username scheme 'elena.sc[counter2]': '[counter2]'
Comment 1 Daniel Tröder univentionstaff 2016-06-23 08:59:31 CEST
Fixed in r70562.
Advisory in r70563.
Comment 2 Sönke Schwardt-Krummrich univentionstaff 2016-07-03 23:34:59 CEST
ucs-test-ucsschool (3.0.13-2):
r70722 | Bug #41645: test lowercase username with ALWAYS2 counter

OK: YAML
OK: functional test (via ucs-test)
OK: code change
Comment 3 Sönke Schwardt-Krummrich univentionstaff 2016-07-04 12:06:32 CEST
UCS@school 4.1 R2 v2 has been released.

If this error occurs again, please clone this bug.