Issue #1979
closedmetadata unit copy action creates incorrect unit count on repo
Description
This issue affects all metadata rpm types: package categories, package groups, package environments, yum_metadata_file, and package_langpacks. I'll illustrate with langpacks, but the same should be true of all of them.
There can only be 1 package_langpacks associated with a repository. You can see that when copying langpacks over and over the count continues to increment even though each copy overwrites the previous one. Consider this reproducer:
pulp-admin rpm repo create --repo-id=repo_1
pulp-admin rpm repo create --repo-id=repo_2
pulp-admin rpm repo uploads langpacks -i hyphen -n hyphen-%s --repo-id repo_1
pulp-admin rpm repo copy langpacks --from-repo-id=repo_1 --to-repo-id=repo_2
pulp-admin rpm repo copy langpacks --from-repo-id=repo_1 --to-repo-id=repo_2
pulp-admin rpm repo copy langpacks --from-repo-id=repo_1 --to-repo-id=repo_2
Now when listing the langpacks units for repo_2 I expect there still to be 1, but instead it shows 3:
[vagrant@dev ~]$ pulp-admin rpm repo list --repo-id repo_2
+----------------------------------------------------------------------+
RPM Repositories
+----------------------------------------------------------------------+
Id: repo_2
Display Name: None
Description: None
Content Unit Counts:
Package Langpacks: 3
There is still in fact only 1 package_langpack which I verified in the database with:
> db.units_package_langpacks.find({"repo_id": "repo_2"}).count()
1
Given ^, the machinery that handles the repo counts is not keep the count correctly. I believe that machinery is here[0].
Moves migration 31 -> 33 so migrations can be introduced in 2.8.z
This allows the fix for issue 1979 to become migration 31 and the fix for issue 1955 to become migration 32. Both of those will be introduced in 2.8-dev and merged forward to master.
https://pulp.plan.io/issues/1979 https://pulp.plan.io/issues/1955
re #1979 re #1955