Skip to content

Bad validation leads to sqlite3 exception #65

@cmd-ntrf

Description

@cmd-ntrf
mc-hub-api-1      | ERROR:root:An error occurred while planning changes. hostname: living-molly.calculquebec.cloud
mc-hub-api-1      | [2022-03-04 16:22:19,448] ERROR in app: Exception on /api/magic-castles [POST]
mc-hub-api-1      | Traceback (most recent call last):
mc-hub-api-1      |   File "/home/mcu/venv/lib/python3.9/site-packages/flask/app.py", line 2073, in wsgi_app
mc-hub-api-1      |     response = self.full_dispatch_request()
mc-hub-api-1      |   File "/home/mcu/venv/lib/python3.9/site-packages/flask/app.py", line 1518, in full_dispatch_request
mc-hub-api-1      |     rv = self.handle_user_exception(e)
mc-hub-api-1      |   File "/home/mcu/venv/lib/python3.9/site-packages/flask_cors/extension.py", line 165, in wrapped_function
mc-hub-api-1      |     return cors_after_request(app.make_response(f(*args, **kwargs)))
mc-hub-api-1      |   File "/home/mcu/venv/lib/python3.9/site-packages/flask/app.py", line 1516, in full_dispatch_request
mc-hub-api-1      |     rv = self.dispatch_request()
mc-hub-api-1      |   File "/home/mcu/venv/lib/python3.9/site-packages/flask/app.py", line 1502, in dispatch_request
mc-hub-api-1      |     return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
mc-hub-api-1      |   File "/home/mcu/mchub/resources/api_view.py", line 32, in decorator
mc-hub-api-1      |     response = route_handler(*args, **kwargs)
mc-hub-api-1      |   File "/home/mcu/mchub/resources/api_view.py", line 53, in decorator
mc-hub-api-1      |     return route_handler(*args, **kwargs)
mc-hub-api-1      |   File "/home/mcu/mchub/resources/api_view.py", line 96, in decorator
mc-hub-api-1      |     return route_handler(user, *args, **kwargs)
mc-hub-api-1      |   File "/home/mcu/venv/lib/python3.9/site-packages/flask/views.py", line 84, in view
mc-hub-api-1      |     return current_app.ensure_sync(self.dispatch_request)(*args, **kwargs)
mc-hub-api-1      |   File "/home/mcu/venv/lib/python3.9/site-packages/flask/views.py", line 158, in dispatch_request
mc-hub-api-1      |     return current_app.ensure_sync(meth)(*args, **kwargs)
mc-hub-api-1      |   File "/home/mcu/mchub/resources/magic_castle_api.py", line 24, in post
mc-hub-api-1      |     magic_castle.plan_creation(json_data)
mc-hub-api-1      |   File "/home/mcu/mchub/models/magic_castle/magic_castle.py", line 339, in plan_creation
mc-hub-api-1      |     database_connection.execute(
mc-hub-api-1      | sqlite3.IntegrityError: UNIQUE constraint failed: magic_castles.hostname

If an error occurs during the first planning phase of a cluster that does not exist, the user is taken back to the create-cluster page instead of the cluster modification page. Therefore, when the user fixes its issue, and try again to create the cluster, the record in the magic_castles database already exists.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions