Issue #6964
closedmigrated errata's pulp3_version_href is not correct after re-migration
Description
After a migration with errata, if i query the migrated content api:
# curl --cert /etc/pki/katello/certs/pulp-client.crt --key /etc/pki/katello/private/pulp-client.key https://`hostname`//pulp/api/v3/pulp2content/6a06b9d9-0cc5-4c28-aea5-ad4ff9f76a48/
I get:
{
"pulp_href": "/pulp/api/v3/pulp2content/6a06b9d9-0cc5-4c28-aea5-ad4ff9f76a48/",
"pulp_created": "2020-06-11T14:41:18.350552Z",
"pulp2_id": "7c084d6e-073e-4310-94e3-5ab06b66ef1e",
"pulp2_content_type_id": "erratum",
"pulp2_last_updated": 1591886473,
"pulp2_storage_path": null,
"downloaded": false,
"pulp3_content": "/pulp/api/v3/content/rpm/advisories/19182792-dc5f-4200-84ca-78a7791d8ad4/",
"pulp3_repository_version": "Noneversions/1/"
}
notice that the pulp3_repository_version is not a valid version.
This only happens after re-migration (and it almost appears that it happens on the 3rd migration of the same plan). In this caes the repos are deleted between each run:
- create repos in pulp2 and run a migration plan similar to this:
{"plugins"=>[{"type"=>"rpm", "repositories"=>[{"name"=>"pulp-uuid-rhel_6_x86_64", "repository_versions"=>[{"pulp2_repository_id"=>"pulp-uuid-rhel_6_x86_64", "pulp2_distributor_repository_ids"=>["pulp-uuid-rhel_6_x86_64"]}], "pulp2_importer_repository_id"=>"pulp-uuid-rhel_6_x86_64"}, {"name"=>"Published LIbrary view-355376805-405955044", "repository_versions"=>[{"pulp2_repository_id"=>"8_view1_archive", "pulp2_distributor_repository_ids"=>["8_composite_version1", "8_composite_version1_archive", "8_view1", "8_view1_archive"]}]}]}]}
- delete the pulp2 repos and re-run the migration plan
- maybe repeat step 2?
Set pulp3_repo relation for all the cases, including remigration.
As a side effect, also fixes the case when a repo name differs from the pulp2 one.
closes #6964 https://pulp.plan.io/issues/6964
closes #6640 https://pulp.plan.io/issues/6640
closes #6966 https://pulp.plan.io/issues/6966