Bug 45456 - [RESTful Import API] client library and import UI do not handle HTTP 404
[RESTful Import API] client library and import UI do not handle HTTP 404
Status: CLOSED DUPLICATE of bug 45023
Product: UCS@school
Classification: Unclassified
Component: HTTP-API (Kelvin)
UCS@school 4.2
Other Linux
: P5 normal (vote)
: ---
Assigned To: UCS@school maintainers
:
Depends on: 45022 45023
Blocks:
  Show dependency treegraph
 
Reported: 2017-09-26 16:01 CEST by Daniel Tröder
Modified: 2023-06-12 15:39 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?: 1: Will affect a very few installed domains
How will those affected feel about the bug?: 1: Nuisance – not a big deal but noticeable
User Pain: 0.017
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 Daniel Tröder univentionstaff 2017-09-26 16:01:40 CEST
When the ucs-school-umc-import UMC UI is installed and opened, and the API cannot be reached (in my case it was simply not installed), this happens:

-------------------------------------

Execution of command 'schoolimport/jobs/query' has failed:


Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/univention/management/console/protocol/modserver.py", line 178, in _recv
    self.handle(msg)
  File "/usr/lib/pymodules/python2.7/univention/management/console/protocol/modserver.py", line 287, in handle
    self.__handler.init()
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/schoolimport/__init__.py", line 66, in init
    self.client = Client(self.username, self.password, log_level=Client.LOG_RESPONSE)
  File "/usr/lib/pymodules/python2.7/ucsschool/http_api/client.py", line 316, in __init__
    setattr(self, cls_name, kls(self))
  File "/usr/lib/pymodules/python2.7/ucsschool/http_api/client.py", line 399, in __init__
    self.resource_url = self.client.resource_urls[self.resource_name]
  File "/usr/lib/pymodules/python2.7/ucsschool/http_api/client.py", line 326, in resource_urls
    self._resource_urls = self.call_api('get', '.')
  File "/usr/lib/pymodules/python2.7/ucsschool/http_api/client.py", line 390, in call_api
    raise exc(msg, status_code=response.status_code)
ObjectNotFound: Received status_code=404 with reason='Not Found' for requests.get(**files=None, url=u'https://m150.uni.dtr/api/v1/', auth=('Administrator', u'**********'), headers={u'Accept': u'application/json'}, params=None, data=None).

-------------------------------------

Modify the Python client and the UMC module to handle 404.
Comment 1 Florian Best univentionstaff 2017-10-11 12:54:09 CEST
commit 41adaef0935bdbbc16b4bf785afe50f46904a64d
Author: Florian Best <best@univention.de>
Date:   Wed Oct 11 12:53:34 2017 +0200

    Bug #45023: handle HTTP 404 error if the API server is not installed

*** This bug has been marked as a duplicate of bug 45023 ***