Issue #7096
closedDeleting a repository with a kickstart raises exception
Description
Hi,
Seems there is an issue when i try to delete a Centos repository :
Jul 07 06:52:44 XXXX rq[1171]: pulp: rq.worker:ERROR: django.db.models.deletion.ProtectedError: ("Cannot delete some instances of model 'Repository' because they are referenced through a protected foreign key: 'Variant.repository'", <QuerySet [<Variant: CentOS>]>) Jul 07 06:52:44 XXXX rq[1171]: Traceback (most recent call last): Jul 07 06:52:44 XXXX rq[1171]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/worker.py", line 883, in perform_job Jul 07 06:52:44 XXXX rq[1171]: rv = job.perform() Jul 07 06:52:44 XXXX rq[1171]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/job.py", line 657, in perform Jul 07 06:52:44 XXXX rq[1171]: self._result = self._execute() Jul 07 06:52:44 XXXX rq[1171]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/job.py", line 663, in _execute Jul 07 06:52:44 XXXX rq[1171]: return self.func(*self.args, **self.kwargs) Jul 07 06:52:44 XXXX rq[1171]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/pulpcore/app/tasks/base.py", line 91, in general_delete Jul 07 06:52:44 XXXX rq[1171]: instance.delete() Jul 07 06:52:44 XXXX rq[1171]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/models/base.py", line 918, in delete Jul 07 06:52:44 XXXX rq[1171]: collector.collect([self], keep_parents=keep_parents) Jul 07 06:52:44 XXXX rq[1171]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/models/deletion.py", line 224, in collect Jul 07 06:52:44 XXXX rq[1171]: field.remote_field.on_delete(self, field, sub_objs, self.using) Jul 07 06:52:44 XXXX rq[1171]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/models/deletion.py", line 27, in PROTECT Jul 07 06:52:44 XXXX rq[1171]: sub_objs Jul 07 06:52:44 XXXX rq[1171]: django.db.models.deletion.ProtectedError: ("Cannot delete some instances of model 'Repository' because they are referenced through a protected foreign key: 'Variant.repository'", <QuerySet [<Variant: CentOS>]>) Jul 07 06:52:44 XXXX rq[1171]: Traceback (most recent call last): Jul 07 06:52:44 XXXX rq[1171]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/worker.py", line 883, in perform_job Jul 07 06:52:44 XXXX rq[1171]: rv = job.perform() Jul 07 06:52:44 XXXX rq[1171]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/job.py", line 657, in perform Jul 07 06:52:44 XXXX rq[1171]: self._result = self._execute() Jul 07 06:52:44 XXXX rq[1171]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/job.py", line 663, in _execute Jul 07 06:52:44 XXXX rq[1171]: return self.func(*self.args, **self.kwargs) Jul 07 06:52:44 XXXX rq[1171]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/pulpcore/app/tasks/base.py", line 91, in general_delete Jul 07 06:52:44 XXXX rq[1171]: instance.delete() Jul 07 06:52:44 XXXX rq[1171]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/models/base.py", line 918, in delete Jul 07 06:52:44 XXXX rq[1171]: collector.collect([self], keep_parents=keep_parents) Jul 07 06:52:44 XXXX rq[1171]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/models/deletion.py", line 224, in collect Jul 07 06:52:44 XXXX rq[1171]: field.remote_field.on_delete(self, field, sub_objs, self.using) Jul 07 06:52:44 XXXX rq[1171]: File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/models/deletion.py", line 27, in PROTECT Jul 07 06:52:44 XXXX rq[1171]: sub_objs Jul 07 06:52:44 XXXX rq[1171]: django.db.models.deletion.ProtectedError: ("Cannot delete some instances of model 'Repository' because they are referenced through a protected foreign key: 'Variant.repository'", <QuerySet [<Variant: CentOS>]>) Jul 07 06:52:44 XXXX rq[1171]: pulp: rq.worker:INFO: 1171@XXXX.awsvault.as44099.net: 8ea8c7f4-32a9-4fea-a775-0129295c9605 Jul 07 06:52:44 XXXX rq[1171]: pulp: rq.worker:INFO: 1171@XXXX.awsvault.as44099.net: Job OK (8ea8c7f4-32a9-4fea-a775-0129295c9605)
Remove FK to the main repo from a distribution tree Variant.
No issues with repository removal. No issues with copying the same distribution tree into multiple repos.
closes #7150 https://pulp.plan.io/issues/7150
closes #7096 https://pulp.plan.io/issues/7096
closes #7046 https://pulp.plan.io/issues/7046
[nocoverage]