Issue #2354
closedIncorrect URL on lazy catalog entries created for existing RPM content units
Description
The YUM importer is creating lazy catalog entries with an incorrect URL when the unit already exists. This affects RPMs, DRPMs and SRPMs. When syncing an existing unit, the importer fetches the unit and associates it to the repository. Then creates a catalog entry. The url is derived by joining the feed url and the unit.download_path property. For packages, property (method) returns the unit.relativepath which is stored in the database. As a result, is the URL for all catalog entries created for a unit has the path component based on the ref (URL) defined in the primary.xml when the unit was originally imported. Instead of, a url based on the ref (URL) in the primary.xml for the upstream repository being sync'd.
Here is an example. Assuming 2 upstream YUM repositories and 2 Pulp repositories with the following layouts:
upstream-A¶
repodata/
server/
bear-4.1-1.noarch.rpm
upstream-B¶
repodata/
packages/
bear-4.1-1.noarch.rpm
When upstream-A is sync'd, it will create a content unit for bear-4.1-1.noarch.rpm as:
unit.relativepath="server/bear-4.1-1.noarch.rpm"
And a catalog entry of:
Entry.url="http://upstream-A.org/content/server/bear-4.1-1.noarch.rpm"
When upstream-B is sync'd, it will find the existing content unit for bear-4.1-1.noarch.rpm and create a catalog entry of:
Entry.url="http://upstream-B.org/content/server/bear-4.1-1.noarch.rpm"
But should have created a catalog entry using the packages directory in the path component as:
Entry.url="http://upstream-B.org/content/packages/bear-4.1-1.noarch.rpm"
The causes the streamer to 404 when trying to download content using the catalog entries with an incorrect URL. The catalog being correct is critical for both on_demand and background download policies to work.
Two things should be fixed:
- The importer needs to create the catalog entry with the correct URL.
- The streamer should try all available catalog entries before returning the 404.
I recommend only correcting the catalog entry for now.
Fix URL in catalog entry created for existing package. closes #2354