Project

Profile

Help

Issue #7948

Migration plan creation fails with HTTP 500 if there is any issue with MP json syntax

Added by ttereshc 6 months ago.

Status:
NEW
Priority:
Normal
Assignee:
-
Sprint/Milestone:
-
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Platform Release:
OS:
Triaged:
No
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Quarter:

Description

Just an extra comma will do.

http POST :/pulp/api/v3/migration-plans/  plan='{"plugins": [{"type": "iso"},]}'
[11951]: 127.0.0.1 - admin [08/Dec/2020:10:40:07 +0000] "POST /pulp/api/v3/migration-plans/ HTTP/1.1" 500 27 "-" "HTTPie/2.3.0"
[11951]: pulp [4bf9ea0a47ee43dd804b8e930aef0710]: django.request:ERROR: Internal Server Error: /pulp/api/v3/migration-plans/
[11951]: Traceback (most recent call last):
[11951]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
[11951]: response = get_response(request)
[11951]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/core/handlers/base.py", line 115, in _get_response
[11951]: response = self.process_exception_by_middleware(e, request)
[11951]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/core/handlers/base.py", line 113, in _get_response
[11951]: response = wrapped_callback(request, *callback_args, **callback_kwargs)
[11951]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
[11951]: return view_func(*args, **kwargs)
[11951]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rest_framework/viewsets.py", line 125, in view
[11951]: return self.dispatch(request, *args, **kwargs)
[11951]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rest_framework/views.py", line 509, in dispatch
[11951]: response = self.handle_exception(exc)
[11951]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rest_framework/views.py", line 469, in handle_exception
[11951]: self.raise_uncaught_exception(exc)
[11951]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
[11951]: raise exc
[11951]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rest_framework/views.py", line 506, in dispatch
[11951]: response = handler(request, *args, **kwargs)
[11951]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rest_framework/mixins.py", line 18, in create
[11951]: serializer.is_valid(raise_exception=True)
[11951]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rest_framework/serializers.py", line 220, in is_valid
[11951]: self._validated_data = self.run_validation(self.initial_data)
[11951]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rest_framework/serializers.py", line 422, in run_validation
[11951]: value = self.validate(value)
[11951]: File "/home/vagrant/devel/pulp-2to3-migration/pulp_2to3_migration/app/serializers.py", line 63, in validate
[11951]: loaded_plan = json.loads(data['plan'])
[11951]: File "/usr/lib64/python3.6/json/__init__.py", line 354, in loads
[11951]: return _default_decoder.decode(s)
[11951]: File "/usr/lib64/python3.6/json/decoder.py", line 339, in decode
[11951]: obj, end = self.raw_decode(s, idx=_w(s, 0).end())
[11951]: File "/usr/lib64/python3.6/json/decoder.py", line 355, in raw_decode
[11951]: obj, end = self.scan_once(s, idx)
[11951]: json.decoder.JSONDecodeError: Expecting ',' delimiter: line 1 column 29 (char 28)

Pulp should error stating that it's syntax problem and propagate the exception all the way up to the user.

Please register to edit this issue

Also available in: Atom PDF