Project

Profile

Help

Issue #1979

closed

metadata unit copy action creates incorrect unit count on repo

Added by bmbouter almost 8 years ago. Updated almost 5 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
High
Assignee:
Sprint/Milestone:
-
Start date:
Due date:
Estimated time:
Severity:
1. Low
Version:
Platform Release:
2.8.5
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Pulp 2
Sprint:
Sprint 3
Quarter:

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].

[0]: https://github.com/pulp/pulp_rpm/blob/d52206bdff5419b5b74976089c605a6cdbeaffc4/plugins/pulp_rpm/plugins/importers/yum/associate.py#L345-L380

Also available in: Atom PDF