Pulp didn't remove a repo - pulp-admin

Problem:

I deleted a repository from my CV/available repository to make a test, I tried to re-add it but this error appear:

Relative URL [ATS-vCentre/Library/content/dist/rhel/server/7/7Server/x86_64/os] for repository [03965942-2178-4673-a146-d660b97f5df8] conflicts with existing relative URL [ATS-vCentre/Library/content/dist/rhel/server/7/7Server/x86_64/os] for repository [d8946303-7782-4197-a43d-7e60be8a11a6]

Expected outcome:

I can re-add the repository

Foreman and Proxy versions:

1.19.1
katello 3.8.1

Foreman and Proxy plugin versions:

pulp-admin-client.noarch               2.16.4-1.el7          @pulp
pulp-client.noarch                     1.0-1                 installed
pulp-deb-plugins.noarch                1.7.1-1.el7           @pulp
pulp-docker-plugins.noarch             3.1.4-2.el7           @pulp
pulp-katello.noarch                    1.0.2-1.el7           @katello
pulp-puppet-plugins.noarch             2.16.4-1.el7          @pulp
pulp-puppet-tools.noarch               2.16.4-1.el7          @pulp
pulp-rpm-plugins.noarch                2.16.4-1.el7          @pulp
pulp-selinux.noarch                    2.16.4-1.el7          @pulp
pulp-server.noarch                     2.16.4-1.el7          @pulp

Other relevant data:

I removed the repo from CV, available products etc, all works fine. I re-add the repos and this appear:

I searched into pulp and it exists:

pulp-admin -u admin -p $pulpAdminPassword repo list

Id:                  d8946303-7782-4197-a43d-7e60be8a11a6
Display Name:        Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server
Description:         None
Content Unit Counts:
  Erratum:                3440
  Package Category:       9
  Package Environment:    6
  Package Group:          76
  Package Langpacks:      1
  Rpm:                    23339
  Srpm:                   1
  Yum Repo Metadata File: 1

and all files are also present into

/var/lib/pulp/published/yum/master/yum_distributor/d8946303-7782-4197-a43d-7e60be8a11a6
/var/lib/pulp/importers/d8946303-7782-4197-a43d-7e60be8a11a6-yum_importer

but i’m not able to delete it with

pulp-admin -u admin -p $pulpAdminPassword yum repo delete --repo-id=d8946303-7782-4197-a43d-7e60be8a11a6

There is a way to delete it?
A second question, not related: which is the best practice to delete all repos and all configuration file for the repos (xml,key,etc) in foreman+katello?

I solved the issue:
(d8946303-7782-4197-a43d-7e60be8a11a6 is my repo)

mongo
use pulp_database
db.repo_distributors.find({"repo_id" : "d8946303-7782-4197-a43d-7e60be8a11a6"})

{ "_id" : ObjectId("5bc603e910f8e007f45a6a05"), "repo_id" : "d8946303-7782-4197-a43d-7e60be8a11a6", "distributor_id" : "export_distributor", "distributor_type_id" : "export_distributor", "config" : { "http" : false, "relative_url" : "ATS-vCentre/Library/content/dist/rhel/server/7/7Server/x86_64/os", "https" : false }, "auto_publish" : false, "last_updated" : ISODate("2018-11-19T09:05:40.449Z"), "last_override_config" : {  }, "scratchpad" : {  }, "_ns" : "repo_distributors" }
{ "_id" : ObjectId("5bc603e910f8e007f45a6a06"), "repo_id" : "d8946303-7782-4197-a43d-7e60be8a11a6", "distributor_id" : "d8946303-7782-4197-a43d-7e60be8a11a6_clone", "distributor_type_id" : "yum_clone_distributor", "config" : { "destination_distributor_id" : "d8946303-7782-4197-a43d-7e60be8a11a6" }, "auto_publish" : false, "last_updated" : ISODate("2018-11-19T09:05:42.012Z"), "last_override_config" : {  }, "scratchpad" : {  }, "_ns" : "repo_distributors" }
{ "_id" : ObjectId("5bc603e910f8e007f45a6a04"), "repo_id" : "d8946303-7782-4197-a43d-7e60be8a11a6", "distributor_id" : "d8946303-7782-4197-a43d-7e60be8a11a6", "distributor_type_id" : "yum_distributor", "config" : { "protected" : true, "http" : false, "relative_url" : "ATS-vCentre/Library/content/dist/rhel/server/7/7Server/x86_64/os", "https" : "false" }, "auto_publish" : true, "last_updated" : ISODate("2018-11-16T11:27:25.724Z"), "last_override_config" : {  }, "scratchpad" : {  }, "_ns" : "repo_distributors", "last_publish" : ISODate("2018-12-01T03:35:24.195Z") }

db.repo_distributors.remove({"repo_id" : "d8946303-7782-4197-a43d-7e60be8a11a6"})
WriteResult({ "nRemoved" : 3 })

db.repo_distributors.find({"repo_id" : "d8946303-7782-4197-a43d-7e60be8a11a6"})

and now the repo is still available.

Hey @kraba,

Glad you got this sorted out, ideally you shouldn’t have to manually delete things in mongo, so it seems there is more investigation need on our part. Was this an upgraded system?

No, wasn’t an upgraded system, is the one with the errata problem described here: RPM1008: Checksum type “sha256” is not available for all units in the repository

@kraba I encountered the same problem and using your mongo commands I was able to solve/fix it.