Problem: After removing a school server the kelvin api is not working anymore

Problem:

After removing a school server the kelvin api is not working anymore. No new data from the id-connector can be received.

In /var/log/univention/ucsschool-kelvin-rest-api/http.log you will find the following Traceback:

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py", line 373, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/usr/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__
    return await self.app(scope, receive, send)
  File "/usr/lib/python3.8/site-packages/fastapi/applications.py", line 199, in __call__
    await super().__call__(scope, receive, send)
  File "/usr/lib/python3.8/site-packages/starlette/applications.py", line 111, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/lib/python3.8/site-packages/starlette/middleware/errors.py", line 181, in __call__
    raise exc from None
  File "/usr/lib/python3.8/site-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "/usr/lib/python3.8/site-packages/starlette/exceptions.py", line 82, in __call__
    raise exc from None
  File "/usr/lib/python3.8/site-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "/usr/lib/python3.8/site-packages/starlette/routing.py", line 566, in __call__
    await route.handle(scope, receive, send)
  File "/usr/lib/python3.8/site-packages/starlette/routing.py", line 227, in handle
    await self.app(scope, receive, send)
  File "/usr/lib/python3.8/site-packages/starlette/routing.py", line 41, in app
    response = await func(request)
  File "/usr/lib/python3.8/site-packages/fastapi/routing.py", line 201, in app
    raw_response = await run_endpoint_function(
  File "/usr/lib/python3.8/site-packages/fastapi/routing.py", line 148, in run_endpoint_function
    return await dependant.call(**values)
  File "/kelvin/kelvin-api/ucsschool/kelvin/routers/school.py", line 233, in search
    return [await SchoolModel.from_lib_model(school, request, udm) for school in schools]
  File "/kelvin/kelvin-api/ucsschool/kelvin/routers/school.py", line 233, in <listcomp>
    return [await SchoolModel.from_lib_model(school, request, udm) for school in schools]
  File "/kelvin/kelvin-api/ucsschool/kelvin/routers/base.py", line 167, in from_lib_model
    kwargs = await cls._from_lib_model_kwargs(obj, request, udm)
  File "/kelvin/kelvin-api/ucsschool/kelvin/routers/school.py", line 91, in _from_lib_model_kwargs
    kwargs["class_share_file_server"] = await cls.computer_dn2name(udm, obj.class_share_file_server)
  File "/kelvin/kelvin-api/ucsschool/kelvin/routers/school.py", line 103, in computer_dn2name
    obj = await udm.obj_by_dn(dn)
  File "/usr/lib/python3.8/site-packages/udm_rest_client/udm.py", line 185, in obj_by_dn
    object_type = await self.session.get_object_type(dn)
  File "/usr/lib/python3.8/site-packages/udm_rest_client/base_http.py", line 330, in get_object_type
    body = await self.get_json(url, allow_redirects=True)
  File "/usr/lib/python3.8/site-packages/udm_rest_client/base_http.py", line 316, in get_json
    raise NoObject(
udm_rest_client.exceptions.NoObject: UDM REST API returned status 404, reason 'Not Found' for URL 'https://dc01.schein.qa/univention/udm/object/cn=slave-03,cn=dc,cn=computers,dc=schein,dc=qa'.
2021-12-17 12:43:13 INFO  172.17.42.1:54300 - "GET /ucsschool/kelvin/v1/schools/%2A HTTP/1.1" 404

Solution:

This happens if a educational server was removed via udm or UMC computers
Unfortunately the educational server could not be added again. The ou needs to be removed and added with the server again.

See Bug 54258