Project

Profile

Help

Issue #6629

can't delete kickstart repository

Added by dkliban@redhat.com 5 months ago. Updated 5 months ago.

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

Description

When I tried to delete a kickstart repository I got the following error in my Task:

(pulp) [vagrant@pulp2-nightly-pulp3-source-centos7 ~]$ http :/pulp/api/v3/tasks/c59c1a92-1ce5-4424-a948-7fbf1124b4f5/
HTTP/1.1 200 OK
Allow: GET, PATCH, DELETE, HEAD, OPTIONS
Connection: Keep-Alive
Content-Length: 1755
Content-Type: application/json
Date: Fri, 01 May 2020 20:13:22 GMT
Keep-Alive: timeout=5, max=10000
Server: gunicorn/20.0.4
Vary: Accept,Cookie
X-Frame-Options: SAMEORIGIN

{
    "child_tasks": [],
    "created_resources": [],
    "error": {
        "description": "(\"Cannot delete some instances of model 'Repository' because they are referenced through a protected foreign key: 'Variant.repository'\", ]>)",
        "traceback": "  File \"/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/worker.py\", line 886, in perform_job\n    rv = job.perform()\n  File \"/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/job.py\", line 664, in perform\n    self._result = self._execute()\n  File \"/usr/local/lib/pulp/lib64/python3.6/site-packages/rq/job.py\", line 670, in _execute\n    return self.func(*self.args, **self.kwargs)\n  File \"/home/vagrant/devel/pulpcore/pulpcore/app/tasks/repository.py\", line 22, in delete\n    models.Repository.objects.filter(pk=repo_id).delete()\n  File \"/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/models/query.py\", line 710, in delete\n    collector.collect(del_query)\n  File \"/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/models/deletion.py\", line 224, in collect\n    field.remote_field.on_delete(self, field, sub_objs, self.using)\n  File \"/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/models/deletion.py\", line 27, in PROTECT\n    sub_objs\n"
    },
    "finished_at": "2020-05-01T20:13:12.201492Z",
    "name": "pulpcore.app.tasks.repository.delete",
    "parent_task": null,
    "progress_reports": [],
    "pulp_created": "2020-05-01T20:13:11.926923Z",
    "pulp_href": "/pulp/api/v3/tasks/c59c1a92-1ce5-4424-a948-7fbf1124b4f5/",
    "reserved_resources_record": [
        "/pulp/api/v3/repositories/rpm/rpm/9581879e-4b4c-4f53-86e9-90319e835ffb/"
    ],
    "started_at": "2020-05-01T20:13:12.082540Z",
    "state": "failed",
    "task_group": null,
    "worker": "/pulp/api/v3/workers/82124443-d497-4889-9075-bed24a6cb29c/"
}

History

#1 Updated by ttereshc 5 months ago

Probably a custom delete endpoint for RpmRepository can solve it. I would guess that sub repos needs to be removed first and then the repo which has them can be removed as well. It should all happen as a one transaction.

#2 Updated by ttereshc 5 months ago

  • Project changed from Pulp to RPM Support

#3 Updated by dkliban@redhat.com 5 months ago

  • Triaged changed from No to Yes

This issue occurs when the user is trying to delete a subrepo that is associated with the DistributionTree.

We need to confirm that subrepos don't show up in the RPM repository list API. If they do, we should exclude them.

We should also have the REST API check if the repository being deleted is a subrepo, and if it is, it should not dispatch a task to perform the delete. Instead it should tell the user the operation is not allowed. Better yet, maybe a 404?

Please register to edit this issue

Also available in: Atom PDF