Bug 1004986

Summary: Refactor YumProfiler._translate_erratum()
Product: [Retired] Pulp Reporter: Randy Barlow <rbarlow>
Component: rpm-supportAssignee: Mike McCune <mmccune>
Status: CLOSED CURRENTRELEASE QA Contact: Preethi Thomas <pthomas>
Severity: high Docs Contact:
Priority: high    
Version: MasterCC: mhrivnak
Target Milestone: ---Keywords: Triaged
Target Release: 2.4.0   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-08-09 06:55:57 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1004981, 1104742    
Bug Blocks: 980611    

Description Randy Barlow 2013-09-05 23:24:09 UTC
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 23:28:14 UTC
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 20:02:29 UTC
This has been fixed as part of the new yum distributor

Comment 4 Jeff Ortel 2014-04-03 13:35:34 UTC
build: 2.4.0-0.7.beta

Comment 5 Randy Barlow 2014-06-26 13:32:46 UTC
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 12:32:57 UTC
[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

+----------------------------------------------------------------------+
                               Installed
+----------------------------------------------------------------------+

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 06:55:57 UTC
This has been fixed in Pulp 2.4.0-1.