Actions
Issue #3019
closedupdating importer results in KeyError: 'view'
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
OS:
Triaged:
No
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Quarter:
Description
This is a new issue that did not exist prior to sometime last week.
http POST http://localhost:1234/api/v3/repositories/ name=mycoolrepo
http POST http://localhost:1234/api/v3/repositories/mycoolrepo/importers/example-futures/ name=mycoolimporter download_policy='immediate' feed_url='https://repos.fedorapeople.org/pulp/pulp/fixtures/file/PULP_MANIFEST' repository='http://localhost:1234/api/v3/repositories/mycoolrepo/' sync_mode='mirror'
http PATCH http://localhost:1234/api/v3/repositories/mycoolrepo/importers/example-futures/mycoolimporter/ download_policy='on_demand'
The following is then emitted in the celery logs:
Task failed : [240c79f9-8bce-4e46-bf6a-5a8b6dac033d]
Task pulpcore.app.tasks.importer.update[240c79f9-8bce-4e46-bf6a-5a8b6dac033d] raised unexpected: KeyError('view',)
Traceback (most recent call last):
File "/home/vagrant/.virtualenvs/pulp/lib/python3.5/site-packages/celery/app/trace.py", line 374, in trace_task
R = retval = fun(*args, **kwargs)
File "/home/vagrant/devel/pulp/platform/pulpcore/tasking/tasks.py", line 272, in __call__
return super(UserFacingTask, self).__call__(*args, **kwargs)
File "/home/vagrant/.virtualenvs/pulp/lib/python3.5/site-packages/celery/app/trace.py", line 629, in __protected_call__
return self.run(*args, **kwargs)
File "/home/vagrant/devel/pulp/platform/pulpcore/app/tasks/importer.py", line 41, in update
serializer.is_valid(raise_exception=True)
File "/home/vagrant/.virtualenvs/pulp/lib/python3.5/site-packages/rest_framework/serializers.py", line 237, in is_valid
self._validated_data = self.run_validation(self.initial_data)
File "/home/vagrant/.virtualenvs/pulp/lib/python3.5/site-packages/rest_framework/serializers.py", line 432, in run_validation
value = self.to_internal_value(data)
File "/home/vagrant/devel/pulp/platform/pulpcore/app/serializers/base.py", line 164, in to_internal_value
parent_field, parent = self.context['view'].get_parent_field_and_object()
KeyError: 'view'
Actions
to_internal_value should not process href_writable field if being called from task
closes #3019 https://pulp.plan.io/issues/3019