Bug 53549 - Renaming school class to existing class throws Internal server error
Renaming school class to existing class throws Internal server error
Status: NEW
Product: UCS@school
Classification: Unclassified
Component: kelvin-rest-api-client
unspecified
Other Mac OS X 10.1
: P5 normal (vote)
: ---
Assigned To: UCS@school maintainers
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2021-07-05 15:34 CEST by Ole Schwiegert
Modified: 2022-07-04 11:55 CEST (History)
2 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 2: Improvement: Would be a product improvement
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.011
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional): bitesize
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ole Schwiegert univentionstaff 2021-07-05 15:34:27 CEST
If you try to rename a school class to a class that already exists, you get a 500 error code. The 400 error from udm rest api is not handled well in kelvin:


2021-07-05 15:30:53 INFO  Modifying SchoolClass(name='BREMEN-School1-2b', school='BREMEN-School1', dn='cn=BREMEN-School1-2b,cn=klassen,cn=schueler,cn=groups,ou=BREMEN-School1,dc=realm1,dc=intranet', old_dn='cn=BREMEN-School1-5c,cn=klassen,cn=schueler,cn=groups,ou=BREMEN-School1,dc=realm1,dc=intranet')
2021-07-05 15:30:53 INFO  172.17.42.1:41324 - "PUT /ucsschool/kelvin/v1/classes/BREMEN-School1/5c HTTP/1.1" 500
2021-07-05 15:30:53 ERROR Exception in ASGI application
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py", line 369, 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 59, 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_class.py", line 342, in complete_update
    await sc_current.modify(udm)
  File "/kelvin/ucs-school-lib/modules/ucsschool/lib/models/base.py", line 621, in modify
    success = await self.modify_without_hooks(lo, validate, move_if_necessary)
  File "/kelvin/ucs-school-lib/modules/ucsschool/lib/models/group.py", line 254, in modify_without_hooks
    success = await super(SchoolClass, self).modify_without_hooks(lo, validate, move_if_necessary)
  File "/kelvin/ucs-school-lib/modules/ucsschool/lib/models/base.py", line 649, in modify_without_hooks
    await self.do_modify(udm_obj, lo)
  File "/kelvin/ucs-school-lib/modules/ucsschool/lib/models/base.py", line 684, in do_modify
    await udm_obj.save()
  File "/usr/lib/python3.8/site-packages/udm_rest_client/base_http.py", line 683, in save
    _, status, header = await self._udm_module.session.call_openapi(**kwargs)
  File "/usr/lib/python3.8/site-packages/udm_rest_client/base_http.py", line 477, in call_openapi
    raise APICommunicationError(
udm_rest_client.exceptions.APICommunicationError: [HTTP 400]: for operation 'update' on 'groups/group' with arguments {'groups_group': {'options': {'ucsschoolAdministratorGroup': False, 'samba': True, 'posix': True, 'ucsschoolImportGroup': False}, 'position': 'cn=klassen,cn=schueler,cn=groups,ou=BREMEN-School1,dc=realm1,dc=intranet', 'properties': {'name': 'BREMEN-School1-2b'}}, 'dn': 'cn=BREMEN-School1-5c,cn=klassen,cn=schueler,cn=groups,ou=BREMEN-School1,dc=realm1,dc=intranet'}: Bad Request: {}