Bug 51606 - The graphical user import cannot be opened and terminates with the following traceback
The graphical user import cannot be opened and terminates with the following ...
Status: CLOSED FIXED
Product: UCS@school
Classification: Unclassified
Component: UMC - User Import UI
UCS@school 4.4
Other Linux
: P5 normal (vote)
: UCS@school 4.4 v5-errata
Assigned To: UCS@school maintainers
Daniel Tröder
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2020-07-03 14:08 CEST by Christina Scheinig
Modified: 2020-07-30 13:14 CEST (History)
4 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?: 3: Will affect average number of installed domains
How will those affected feel about the bug?: 5: Blocking further progress on the daily work
User Pain: 0.257
Enterprise Customer affected?:
School Customer affected?: Yes
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number: 2020070321000511
Bug group (optional):
Max CVSS v3 score:


Attachments
screenshot of succesful import (99.08 KB, image/png)
2020-07-09 16:13 CEST, Tobias Wenzel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christina Scheinig univentionstaff 2020-07-03 14:08:42 CEST
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/univention/management/console/base.py", line 358, in __error_handling
   six.reraise(etype, exc, etraceback)
File "/usr/lib/python2.7/dist-packages/univention/management/console/protocol/modserver.py", line 188, in _recv
   self.handle(msg)
File "/usr/lib/python2.7/dist-packages/univention/management/console/protocol/modserver.py", line 257, in handle
   six.reraise(self.__init_etype, self.__init_exc, self.__init_etraceback)
File "/usr/lib/python2.7/dist-packages/univention/management/console/protocol/modserver.py", line 298, in handle
   self.__handler.init()
File "/usr/lib/pymodules/python2.7/univention/management/console/modules/schoolimport/__init__.py", line 69, in init
   ssl_verify=ssl_verify,
File "/usr/lib/pymodules/python2.7/ucsschool/http_api/client.py", line 383, in __init__
   setattr(self, cls_name, kls(self))
File "/usr/lib/pymodules/python2.7/ucsschool/http_api/client.py", line 475, in __init__
   self.resource_url = self.client.resource_urls[self.resource_name]
File "/usr/lib/pymodules/python2.7/ucsschool/http_api/client.py", line 396, in resource_urls
   raise IllegalURLError('URL {!r} for resource {!r} from API root does not start with {!r}.'.format(url, resource, self.base_url))
IllegalURLError: URL u'https://foobucs01.schulen.schein.de/api/v1/schools/' for resource u'schools' from API root does not start with
u'https://fOOBucs01.schulen.schein.de/api/v1/'.
Comment 1 Ingo Steuwer univentionstaff 2020-07-03 14:39:39 CEST
Does this happen directly after an installation? Or are other steps needed to reproduce the traceback?
Comment 2 Marc Schwarz univentionstaff 2020-07-03 16:19:09 CEST
there are no users imported to the system yet, this occured from the first try on the customers system.
Comment 3 Ingo Steuwer univentionstaff 2020-07-03 16:29:30 CEST
(In reply to Marc Schwarz from comment #2)
> there are no users imported to the system yet, this occured from the first
> try on the customers system.

Thanks, I increase "Who will be affected by this bug?" then.
Comment 4 Tobias Wenzel univentionstaff 2020-07-09 16:13:58 CEST
Created attachment 10422 [details]
screenshot of succesful import
Comment 5 Tobias Wenzel univentionstaff 2020-07-09 16:18:30 CEST
I tried to reproduce the problem with the graphical user import (see screenshot), but had no problem/ error while importing the students. 
Maybe the problem lies somewhere else? If not, a possible fix can be fount in

[twenzel/51606_import_traceback] e1947b9f3 Bug #51606: case insensitive checking of school base_url

UCS: 4.4-3 errata456
Installed: cups=2.2.1 samba4=4.10 squid=3.5 ucsschool=4.4 v4
Comment 6 Tobias Wenzel univentionstaff 2020-07-14 10:47:07 CEST
I could finally reproduce the problem:

Simply set 

ucsschool/import/http_api/client/server="ucs-2890.Wenzel-univention.intranet"

instead of lowercase 'wenzel'. When running into this exact error, this can also work as a quick-fix, because the address is composed this way:

server = ucr.get("ucsschool/import/http_api/client/server") or "{}.{}".format(
            ucr["hostname"], ucr["domainname"])

The fix, which I added in comment #5 is already working.
Comment 7 Daniel Tröder univentionstaff 2020-07-17 16:23:30 CEST
OK: reproducible by calling ucsschool.http_api.client.Client() with the DC masters FQDN in a case different from that saved in UCR:

----------------------------------------------------------------
# ucr get hostname; ucr get domainname
m70
uni.dtr

# python -c "from ucsschool.http_api.client import Client; client = Client(name='Administrator', password='univention', server='m70.uni.dtr')"

(m70.uni.dtr → no error)

# python -c "from ucsschool.http_api.client import Client; client = Client(name='Administrator', password='univention', server='M70.uni.dtr')"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/pymodules/python2.7/ucsschool/http_api/client.py", line 411, in __init__
    setattr(self, cls_name, kls(self))
  File "/usr/lib/pymodules/python2.7/ucsschool/http_api/client.py", line 531, in __init__
    self.resource_url = self.client.resource_urls[self.resource_name]
  File "/usr/lib/pymodules/python2.7/ucsschool/http_api/client.py", line 432, in resource_urls
    url, resource, self.base_url
ucsschool.http_api.client.IllegalURLError: URL u'https://m70.uni.dtr/api/v1/schools/' for resource u'schools' from API root does not start with u'https://M70.uni.dtr/api/v1/'.

(M70.uni.dtr → error)
----------------------------------------------------------------

OK: after applying the patch in e1947b9f3 from twenzel/51606_import_traceback, the same call (with M70.uni.dtr) does not raise an error anymore.

I added a test for this:

[twenzel/51606_import_traceback f62a1b8ba] Bug #51606: test Newton client server name not matching hosts fqdn regarding case

Please merge.
Comment 8 Tobias Wenzel univentionstaff 2020-07-17 17:40:40 CEST
Merged and built

[4.4] 07723d218 Bug #51606: changelog & yaml
[4.4] 30bceaeaa Bug #51606: Merge branch 'twenzel/51606_import_traceback' into 4.4
[4.4] f62a1b8ba Bug #51606: test Newton client server name not matching hosts fqdn regarding case
[4.4] e1947b9f3 Bug #51606: case insensitive checking of school base_url


Package: ucs-school-import
Version: 17.0.39A~4.4.0.202007171700
Branch: ucs_4.4-0
Scope: ucs-school-4.4

Package: ucs-test-ucsschool
Version: 6.0.124A~4.4.0.202007171716
Branch: ucs_4.4-0
Scope: ucs-school-4.4
Comment 9 Daniel Tröder univentionstaff 2020-07-17 18:24:59 CEST
OK: merge and build
OK: advisory
Comment 10 Tobias Wenzel univentionstaff 2020-07-30 13:14:54 CEST
UCS@school 4.4 v5 has been released (errata update to the release).

http://docs.software-univention.de/changelog-ucsschool-4.4v5-de.html#changelog:ucsschool:2020-07-30

If this error occurs again, please clone this bug.