Foreman 2.5.1 / Katello 4.1: Unable to re-upload a rpm to a repo

I had a product with 1 file repo in it that contained “NessusAgent-8.2.4-es7.x86_64.rpm” which had been uploaded with

hammer repository upload-content

Now I realised I wanted to do it differently so I deleted the product and the repo and re-created the product (same name) and the repo (same name) as a yum repo instead of file repo.
Now when I try to upload “NessusAgent-8.2.4-es7.x86_64.rpm” I get an error:

Could not upload the content:
  Task ac48948f-4ed7-431c-bc73-4d2bc5226d8a: Katello::Errors::Pulp3Error: {'non_field_errors': [ErrorDetail(string="Artifact with sha256 checksum of '0a569cc52fd38335e34b7037cf9108fe6117d38b4e91cf5da5018f794c2999f4' already exists.", code='unique')]}

Task output

{"pulp_tasks"=>
  [{"pulp_href"=>"/pulp/api/v3/tasks/afeace65-f1fe-4e03-94c8-35b6ad0a1548/",
    "pulp_created"=>"2021-07-08T09:57:53.036+00:00",
    "state"=>"failed",
    "name"=>"pulpcore.app.tasks.upload.commit",
    "logging_cid"=>"69c4cd48-1781-4b6d-9710-763921ad8382",
    "started_at"=>"2021-07-08T09:57:53.173+00:00",
    "finished_at"=>"2021-07-08T09:57:53.477+00:00",
    "error"=>
     {"traceback"=>
       "  File \"/usr/lib/python3.6/site-packages/rq/worker.py\", line 975, in perform_job\n" +
       "    rv = job.perform()\n" +
       "  File \"/usr/lib/python3.6/site-packages/rq/job.py\", line 696, in perform\n" +
       "    self._result = self._execute()\n" +
       "  File \"/usr/lib/python3.6/site-packages/rq/job.py\", line 719, in _execute\n" +
       "    return self.func(*self.args, **self.kwargs)\n" +
       "  File \"/usr/lib/python3.6/site-packages/pulpcore/app/tasks/upload.py\", line 38, in commit\n" +
       "    serializer.is_valid(raise_exception=True)\n" +
       "  File \"/usr/lib/python3.6/site-packages/rest_framework/serializers.py\", line 228, in is_valid\n" +
       "    raise ValidationError(self.errors)\n",
      "description"=>
       "{'non_field_errors': [ErrorDetail(string=\"Artifact with sha256 checksum of '0a569cc52fd38335e34b7037cf9108fe6117d38b4e91cf5da5018f794c2999f4' already exists.\", code='unique')]}"},
    "worker"=>"/pulp/api/v3/workers/8824a696-5bb5-4f70-83aa-cab0a7c7996a/",
    "child_tasks"=>[],
    "progress_reports"=>[],
    "created_resources"=>[],
    "reserved_resources_record"=>
     ["/pulp/api/v3/uploads/976aad69-7d83-407a-b686-894f6a2c21f8/"]}],
 "task_groups"=>[],
 "poll_attempts"=>{"total"=>1, "failed"=>1}}

How do I find the offending artifact and nuke it?

I think deleting the repo or product won’t actually delete the packages but only abandon them, leaving them to be cleaned up later. Have you tried running

# foreman-rake katello:delete_orphaned_content RAILS_ENV=production --trace

There is a cron job which usually runs this Sunday night.

1 Like

Ok I see. Thanks