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

       "  File \"/usr/lib/python3.6/site-packages/rq/\", line 975, in perform_job\n" +
       "    rv = job.perform()\n" +
       "  File \"/usr/lib/python3.6/site-packages/rq/\", line 696, in perform\n" +
       "    self._result = self._execute()\n" +
       "  File \"/usr/lib/python3.6/site-packages/rq/\", line 719, in _execute\n" +
       "    return self.func(*self.args, **self.kwargs)\n" +
       "  File \"/usr/lib/python3.6/site-packages/pulpcore/app/tasks/\", line 38, in commit\n" +
       "    serializer.is_valid(raise_exception=True)\n" +
       "  File \"/usr/lib/python3.6/site-packages/rest_framework/\", line 228, in is_valid\n" +
       "    raise ValidationError(self.errors)\n",
       "{'non_field_errors': [ErrorDetail(string=\"Artifact with sha256 checksum of '0a569cc52fd38335e34b7037cf9108fe6117d38b4e91cf5da5018f794c2999f4' already exists.\", code='unique')]}"},
 "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