Bug 48243 - maildomain in JSON config is required to use scheme:email
maildomain in JSON config is required to use scheme:email
Status: CLOSED FIXED
Product: UCS@school
Classification: Unclassified
Component: Import scripts
UCS@school 4.4
Other Linux
: P5 normal (vote)
: UCS@school 4.4 v9-errata
Assigned To: Toni Röhmeyer
Tobias Wenzel
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2018-11-30 10:42 CET by Sönke Schwardt-Krummrich
Modified: 2021-05-06 14:10 CEST (History)
2 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 1: Cosmetic issue or missing function but workaround exists
Who will be affected by this bug?: 3: Will affect average number of 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.034
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 Sönke Schwardt-Krummrich univentionstaff 2018-11-30 10:42:04 CET
maildomain in JSON config is required to use scheme:email. Alternatively if maildomain is not set, the UCRV mail/hosteddomains is used. If this UCRV is not set, scheme:email is not used and no mail addresses are generated without any further notice/debug output.
Comment 1 Sönke Schwardt-Krummrich univentionstaff 2018-11-30 10:51:41 CET
6d3bc17e7 Bug #48243: improve import manual
Comment 2 Daniel Tröder univentionstaff 2019-01-23 09:09:58 CET
I suggest to add a test to ucs-school-import/usr/share/ucs-school-import/checks/defaults.py.
It would verify (and abort if not) that
if config{scheme:email} is set, a domain can be found with either
    config{maildomain} or
    ucr{mail/hosteddomains}.

@sönke: OK?
Comment 3 Toni Röhmeyer univentionstaff 2020-02-19 10:49:56 CET
Implemented the suggested check to ucs-school-import/usr/share/ucs-school-import/checks/defaults.py.

Behavior was tested by importing a testuser.csv while no maildomain was specified and mail/hosteddomains was unset.

Solution pushed to branch troehmey/bug48243 with commit

commit ffc95c7c2a29518ad08662c65302092b90452ebb
Bug #48243: added importer check


Waiting for QA
Comment 4 Tobias Wenzel univentionstaff 2021-04-13 16:11:27 CEST
QA → All OK

→ rebase, merge, etc.
since there is no pre-commit in this branch you will have to do this e.g. manually (not too much, only one file)


before fix:

email is set to none, no error

after fix

 File "/usr/share/ucs-school-import/checks/defaults.py", line 216, in test_maildomain_is_set
    raise InitialisationError('No domain could be found in the configuration or under locally hosted domains.')
InitialisationError: No domain could be found in the configuration or under locally hosted domains.

is raised when importing 

"Schulen","Vorname","Nachname","Klassen","Telefonnumer"
"DEMOSCHOOL","Anton1","Meyer","DEMOSCHOOL-1A,DEMOSCHOOL-2B",""

with 

"scheme": {  
                        "email": "<:umlauts><firstname>.<lastname><:lower>[COUNTER2]@<maildomain>",  
		...
}

making sure everything works as before:

ucr set mail/hosteddomains="wenzel-univention.intranet,some-domain.intranet"
→ no error, first domain is used for maildomain

setting 
"maildomain": "some-univention-domain.intranet"

in the user_import.json

→ no error, correct maildomain is used.
Comment 5 Toni Röhmeyer univentionstaff 2021-04-22 19:10:25 CEST
I applied the fix in a new commit directly on branch 4.4 in order to deal with the missing pre-commit on the feature branch and avoid unnecessary fixups and merging:

415245af8 Bug #48243: added yaml
718a634b7 Bug #48243: added changelog entry
d4a2b0d4a Bug #48243: added importer check test_maildomain_is_set


I also tested the behavior once more, just to be sure.

Successful build:

Package: ucs-school-import
Version: 17.0.55A~4.4.0.202104221857
Branch: ucs_4.4-0
Scope: ucs-school-4.4
Comment 6 Tobias Wenzel univentionstaff 2021-04-23 08:38:24 CEST
QA → All OK → Verify

Merge/ new commit → OK, because change is very small
changelog → OK
yaml → OK
Jenkins → happy
Comment 7 Tobias Wenzel univentionstaff 2021-05-06 14:10:51 CEST
Errata updates for UCS@school 4.4 v9 have been released.

https://docs.software-univention.de/changelog-ucsschool-4.4v9-de.html

If this error occurs again, please clone this bug.