Katello 4.3.0: cannot delete repositories

I have just upgraded from 4.2 to 4.3.0 on CentOS 7.9 yesterday. Due to dependency issues, I have had to remove the package “python3-pulp-2to3-migration” before the upgrade. After that, the upgrade procedure went well and foreman-installer run successfully.

Now I have wanted to remove some old foreman repositories which are not used anymore, starting with my two foreman client 2.5 repos for el7 and el8. However, the task failed for el8 and for el7 it is now stuck in the first step Actions::Pulp3::Repository::DeleteRemote.

The failed task exception:

Katello::Errors::Pulp3Error: update or delete on table "core_remote" violates foreign key constraint "pulp_2to3_migration__pulp3_repository_rem_816578fe_fk_core_remo" on table "pulp_2to3_migration_pulp2repository"
DETAIL:  Key (pulp_id)=(e9affc2b-8aa7-486a-9bc8-d9d7d74ff2f3) is still referenced from table "pulp_2to3_migration_pulp2repository".

I guess the remnants from the pulp2 to pulp3 migration are still present in the database starting to cause issues now…

Foreman 3.1.2, Katello 4.3.0 (upgraded from 4.2 yesterday).
tfm-pulpcore-python3-pulp-rpm-3.17.3-2.el7.noarch
tfm-pulpcore-python3-pulpcore-3.16.6-1.el7.noarch

Hi @gvde,

Try running the remove-pulp2 procedure with the command foreman-rake content remove-pulp2.

This drops all the 2to3 migration tables.

Thanks. You have meant:

# foreman-maintain content remove-pulp2

That cleared out the migration tables from the database. Too bad, that this isn’t run automatically during upgrades after you have already made the pulp3 migration. The removal of the migration tables must have been added later because I ran remove-pulp2 originally before upgrading to 4.0…

Of course, now I have the orphaned remotes for the two foreman client repos in the database which I have deleted in Katello…