Actions
Issue #6058
closedre-migrating after deleting a pulp2 repo errors with: AttributeError: 'NoneType' object has no attribute 'publication_set'
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Katello
Sprint:
Sprint 65
Quarter:
Description
Here's what i did:
Created a migration plan to migrate 2 repositories:
{"plugins":\[{"type":"iso","repositories":\[{"name":"5b08c8a6-d3bb-41af-9cd4-cadf8fec2a55","repository_versions":\[{"pulp2_repository_id":"5b08c8a6-d3bb-41af-9cd4-cadf8fec2a55","pulp2_distributor_repository_ids":\["5b08c8a6-d3bb-41af-9cd4-cadf8fec2a55"\]}\],"pulp2_importer_repository_id":"5b08c8a6-d3bb-41af-9cd4-cadf8fec2a55"},{"name":"file_test-1-2","repository_versions":\[{"pulp2_repository_id":"1-file_test-v1_0-5b08c8a6-d3bb-41af-9cd4-cadf8fec2a55","pulp2_distributor_repository_ids":\["1-file_test-Library-5b08c8a6-d3bb-41af-9cd4-cadf8fec2a55"\]}\]}\]}\]}
Then deleted one of the repos in pulp2, and created a new plan to migrate the one that is remaining:
{"plugins":[{"type":"iso","repositories":[{"name":"5b08c8a6-d3bb-41af-9cd4-cadf8fec2a55","repository_versions":[{"pulp2_repository_id":"5b08c8a6-d3bb-41af-9cd4-cadf8fec2a55","pulp2_distributor_repository_ids":["5b08c8a6-d3bb-41af-9cd4-cadf8fec2a55"]}],"pulp2_importer_repository_id":"5b08c8a6-d3bb-41af-9cd4-cadf8fec2a55"}]}]}
I then tried to list from the pulp2repositories api, and i get an error:
pulp: django.request:ERROR: Internal Server Error: /pulp/api/v3/pulp2repositories/
Traceback (most recent call last):
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/core/handlers/base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/core/handlers/base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/views/decorators/csrf.py", line 71, in wrapped_view
return view_func(*args, **kwargs)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rest_framework/viewsets.py", line 114, in view
return self.dispatch(request, *args, **kwargs)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rest_framework/views.py", line 505, in dispatch
response = self.handle_exception(exc)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rest_framework/views.py", line 465, in handle_exception
self.raise_uncaught_exception(exc)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rest_framework/views.py", line 476, in raise_uncaught_exception
raise exc
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rest_framework/views.py", line 502, in dispatch
response = handler(request, *args, **kwargs)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rest_framework/mixins.py", line 43, in list
return self.get_paginated_response(serializer.data)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rest_framework/serializers.py", line 757, in data
ret = super().data
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rest_framework/serializers.py", line 261, in data
self._data = self.to_representation(self.instance)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rest_framework/serializers.py", line 675, in to_representation
self.child.to_representation(item) for item in iterable
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rest_framework/serializers.py", line 675, in <listcomp>
self.child.to_representation(item) for item in iterable
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rest_framework/serializers.py", line 526, in to_representation
ret[field.field_name] = field.to_representation(attribute)
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rest_framework/fields.py", line 1873, in to_representation
return method(value)
File "/usr/local/lib/pulp/src/pulp/pulp_2to3_migration/app/serializers.py", line 184, in get_pulp3_publication_href
pub_list = obj.pulp3_repository_version.publication_set.all()
AttributeError: 'NoneType' object has no attribute 'publication_set'
Actions
Fix rendering of the pulp2repositories after a failed migration.
closes #6058