Bug 1004986 - Refactor YumProfiler._translate_erratum()
Refactor YumProfiler._translate_erratum()
Product: Pulp
Classification: Community
Component: rpm-support (Show other bugs)
All All
high Severity high
: ---
: 2.4.0
Assigned To: Mike McCune
Preethi Thomas
: Triaged
Depends On: 1004981 1104742
Blocks: 980611
  Show dependency treegraph
Reported: 2013-09-05 19:24 EDT by Randy Barlow
Modified: 2014-08-09 02:55 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2014-08-09 02:55:57 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Randy Barlow 2013-09-05 19:24:09 EDT
There are two problems with the _translate_erratum() method:

1) The _translate_erratum() function in the YumProfiler generates a string that contains the full NEVRA for each RPM than an erratum references, and inserts that string as the 'name' field of the "unit" dictionary that represents the RPM. This is a departure from what the install_units() method does with RPMs (it leaves the dictionaries as having all of the NEVRA fields.)

The _translate_erratum() function should instead provide unit keys as its output, so that the output for RPMs and Erratum returned by install_units() is consistent.

2) In #980611, Erratum RPMs can end up with None as the Epoch due to a bug in Yum (which our distributor uses). When the Epoch for an RPM is None, _translate_erratum() ends up generating package names like <package_name>-None:<version>-<release>.<arch>. The -None ends up causing the consumer to fail to install the package, since there is likely not a package called <package_name>-None available to it.

To fix this, the refactored _translate_erratum() should only include the Epoch in the unit key that it generates if one is available.

I do acknowledge that there is a bit of a contradiction in my use of "unit_key" as the expected output of _translate_erratum(), since a unit key in this case does have an epoch, and I am suggesting that we drop epoch when it is unavailable. So what I mean by "unit_key" is "most complete version of a unit_key that we can generate here with the available information".
Comment 1 Randy Barlow 2013-09-05 19:28:14 EDT
Fixing this bug should help us to resolve the symptoms (but not the true cause) of #980611. The cause of that bug is that Yum generates bad XML that lacks the epoch during publishing.

This bug can only be fixed if we also fix #1004981, because the current _translate_erratum() depends on the agent only using the name field (which is the subject of that bug). These two bugs must be fixed for the same Pulp release.
Comment 2 Jason Connor 2013-11-13 15:02:29 EST
This has been fixed as part of the new yum distributor
Comment 4 Jeff Ortel 2014-04-03 09:35:34 EDT
build: 2.4.0-0.7.beta
Comment 5 Randy Barlow 2014-06-26 09:32:46 EDT
Preethi, to verify this bug you should try to make sure you can do these two things:

1) Use pulp-admin's rpm consumer section to install a package on a consumer by name only.

2) Use pulp-admin's rpm consumer section to install a package by name-version-release.

I think the help text on the consumer install command just has --name, but you should be able to pass name-version-release. I think there might be a bug filed about that issue, but I can't remember for sure.
Comment 6 Preethi Thomas 2014-06-27 08:32:57 EDT
[root@yttrium ~]# pulp-admin rpm consumer package install run --consumer-id patch -n zebra
Install task created with id [ ed338168-5424-49ba-944e-9b2437c75946 ]

This command may be exited via ctrl+c without affecting the request.

Refresh Repository Metadata             [ OK ]
Downloading Packages                    [ OK ]
Check Package Signatures                [ OK ]
Running Test Transaction                [ OK ]
Running Transaction                     [ OK ]

Install Succeeded


Name:    zebra
Version: 0.1
Arch:    noarch
Repoid:  zoo

                       Installed for Dependencies

Name:    lion
Version: 0.4
Arch:    noarch
Repoid:  zoo

Name:    elephant
Version: 8.3
Arch:    noarch
Repoid:  zoo

Name:    crow
Version: 0.8
Arch:    noarch
Repoid:  zoo

Name:    tiger
Version: 1.0
Arch:    noarch
Repoid:  zoo

Name:    dolphin
Version: 3.10.232
Arch:    noarch
Repoid:  zoo

Name:    gorilla
Version: 0.62
Arch:    noarch
Repoid:  zoo

Name:    bear
Version: 4.1
Arch:    noarch
Repoid:  zoo

Name:    kangaroo
Version: 0.2
Arch:    noarch
Repoid:  zoo

Name:    pike
Version: 2.2
Arch:    noarch
Repoid:  zoo

[root@yttrium ~]#
Comment 7 Randy Barlow 2014-08-09 02:55:57 EDT
This has been fixed in Pulp 2.4.0-1.

Note You need to log in before you can comment on or make changes to this bug.