Issue #5478
Updated by daviddavis about 5 years ago
Steps to reproduce:
<pre>
http :/pulp/api/v3/repostories/ name=foo
http :/pulp/api/v3/repositories/<uuid>/versions/ remove_content_units:="[\"*\"]"
</pre>
Error:
<pre> {
"_created": "2019-09-18T19:16:23.910811Z",
"_href": "/pulp/api/v3/tasks/8ceebd1c-fb03-42b0-a1bb-8981ad665c68/",
"created_resources": [],
"error": {
"description": "'NoneType' object has no attribute 'content'",
"traceback": " File \"/usr/local/lib/pulp/lib64/python3.7/site-packages/rq/worker.py\", line 822, in perform_job\n rv = job.perform()\n File \"/usr/local/lib/pulp/lib64/python3.7/site-packages/rq/job.py\", line 605, in perform\n self._result = self._execute()\n File \"/usr/local/lib/pulp/lib64/python3.7/site-packages/rq/job.py\", line 611, in _execute\n return self.func(*self.args, **self.kwargs)\n File \"/home/vagrant/devel/pulpcore/pulpcore/app/tasks/repository.py\", line 92, in add_and_remove\n remove_content_units = latest.content.values_list('pk', flat=True)\n"
},
"finished_at": "2019-09-18T19:16:24.157756Z",
"name": "pulpcore.app.tasks.repository.add_and_remove",
"non_fatal_errors": [],
"parent": null,
"progress_reports": [],
"reserved_resources_record": [
"/pulp/api/v3/repositories/885643cc-49ec-402f-840e-948bd341798c/"
],
"spawned_tasks": [],
"started_at": "2019-09-18T19:16:24.111274Z",
"state": "failed",
"worker": "/pulp/api/v3/workers/6bf34752-51ff-450a-96ca-5aa6c22d4c91/"
}
</pre>
My initial feeling is that we should raise an error if you try to remove all units and there is no repo version.