Project

Profile

Help

Issue #5546

closed

migration plan creation expects 'plan' to be pre-serialized within bindings

Added by jsherril@redhat.com about 5 years ago. Updated over 4 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Sprint/Milestone:
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
API Bindings
Sprint:
Sprint 61
Quarter:

Description

From the ruby bindings when calling the api to create a plan:

        migration_plan_api.create(plan: {"plugins":[{"type":"iso"}]})

this throws an error on the server:

Oct  7 15:27:14 devel2 gunicorn: pulp: django.request:ERROR: Internal Server Error: /pulp/api/v3/migration-plans/
Oct  7 15:27:14 devel2 gunicorn: Traceback (most recent call last):
Oct  7 15:27:14 devel2 gunicorn: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
Oct  7 15:27:14 devel2 gunicorn: response = get_response(request)
Oct  7 15:27:14 devel2 gunicorn: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/core/handlers/base.py", line 115, in _get_response
Oct  7 15:27:14 devel2 gunicorn: response = self.process_exception_by_middleware(e, request)
Oct  7 15:27:14 devel2 gunicorn: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/core/handlers/base.py", line 113, in _get_response
Oct  7 15:27:14 devel2 gunicorn: response = wrapped_callback(request, *callback_args, **callback_kwargs)
Oct  7 15:27:14 devel2 gunicorn: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
Oct  7 15:27:14 devel2 gunicorn: return view_func(*args, **kwargs)
Oct  7 15:27:14 devel2 gunicorn: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rest_framework/viewsets.py", line 114, in view
Oct  7 15:27:14 devel2 gunicorn: return self.dispatch(request, *args, **kwargs)
Oct  7 15:27:14 devel2 gunicorn: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rest_framework/views.py", line 505, in dispatch
Oct  7 15:27:14 devel2 gunicorn: response = self.handle_exception(exc)
Oct  7 15:27:14 devel2 gunicorn: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rest_framework/views.py", line 465, in handle_exception
Oct  7 15:27:14 devel2 gunicorn: self.raise_uncaught_exception(exc)
Oct  7 15:27:14 devel2 gunicorn: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rest_framework/views.py", line 476, in raise_uncaught_exception
Oct  7 15:27:14 devel2 gunicorn: raise exc
Oct  7 15:27:14 devel2 gunicorn: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rest_framework/views.py", line 502, in dispatch
Oct  7 15:27:14 devel2 gunicorn: response = handler(request, *args, **kwargs)
Oct  7 15:27:14 devel2 gunicorn: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rest_framework/mixins.py", line 18, in create
Oct  7 15:27:14 devel2 gunicorn: serializer.is_valid(raise_exception=True)
Oct  7 15:27:14 devel2 gunicorn: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rest_framework/serializers.py", line 235, in is_valid
Oct  7 15:27:14 devel2 gunicorn: self._validated_data = self.run_validation(self.initial_data)
Oct  7 15:27:14 devel2 gunicorn: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rest_framework/serializers.py", line 433, in run_validation
Oct  7 15:27:14 devel2 gunicorn: value = self.validate(value)
Oct  7 15:27:14 devel2 gunicorn: File "/usr/local/lib/pulp/src/pulp/pulp_2to3_migration/app/serializers.py", line 49, in validate
Oct  7 15:27:14 devel2 gunicorn: loaded_plan = json.loads(data['plan'])
Oct  7 15:27:14 devel2 gunicorn: File "/usr/lib64/python3.6/json/__init__.py", line 348, in loads
Oct  7 15:27:14 devel2 gunicorn: 'not {!r}'.format(s.__class__.__name__))
Oct  7 15:27:14 devel2 gunicorn: TypeError: the JSON object must be str, bytes or bytearray, not 'dict'

pre-serializing the data seems to get past it:

        migration_plan_api.create(plan: {"plugins":[{"type":"iso"}]}.to_json)

which seems quite different than the rest of the api

Also available in: Atom PDF