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)
Updated by dkliban@redhat.com over 4 years ago
- Project changed from Pulp to RPM Support
- Category deleted (
Installer - Moved to GitHub issues)
Updated by daviddavis over 4 years ago
- Triaged changed from No to Yes
We discussed this during our RPM meeting but didn't come up with a good solution. The problem is that the variant has a foreign key to the repository. So essentially the distribution tree is pointing back to the repository that contains it.
Updated by daviddavis over 4 years ago
- Subject changed from Repository deletion issue to Deleting a repository with a kickstart raises exception
Updated by ttereshc over 4 years ago
- Assignee set to ttereshc
- Sprint set to Sprint 77
Added by ttereshc over 4 years ago
Updated by ttereshc over 4 years ago
- Status changed from NEW to MODIFIED
Applied in changeset ca39e84c97a2bf96025b80cde4576fd4e720a61b.
Updated by ttereshc over 4 years ago
- Status changed from MODIFIED to CLOSED - CURRENTRELEASE
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]