Bug 751294

Summary: yum does not write to stderr raised exception by plugin, which inherit from YumBaseError.
Product: Red Hat Enterprise Linux 5 Reporter: Miroslav Suchý <msuchy>
Component: rhn-client-toolsAssignee: Stephen Herr <sherr>
Status: CLOSED ERRATA QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: medium Docs Contact:
Priority: low    
Version: 5.7CC: chinchek, dyordano, freznice, jhutar, jmikulka, jzeleny, ksrot, lmiksik, mminar, msuchy, tcallawa
Target Milestone: rcKeywords: Patch
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: rhn-client-tools-0.4.20.1-8-el5 Doc Type: Bug Fix
Doc Text:
Cause: An error class in rhn-client-tools did not correctly sub-class the yum errors. Consequence: Some networking problems would throw a traceback instead of getting correctly logged or reported on the command line. Fix: Update the Error inheritance structure. Result: Errors should now get correctly logged and reported.
Story Points: ---
Clone Of: 595837 Environment:
Last Closed: 2014-09-16 00:25:14 UTC Type: ---
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: 595837    
Bug Blocks: 751292, 1049888    
Attachments:
Description Flags
Subclass YumBaseError without defining __len__ = None. none

Comment 1 James Antill 2011-11-16 15:53:51 UTC
99% sure this will be a unicode thing ... as logger eats unicode instead of doing a Unicode exception.

Comment 2 Zdeněk Pavlas 2013-03-08 14:14:12 UTC
Quickly searched the code.. Seems this is the only place where Yum sends to_unicode() to logger.  Fixing this very likely fixes BZ 824663 too.

Comment 4 RHEL Program Management 2013-05-01 06:41:14 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unable to address this
request at this time.

Red Hat invites you to ask your support representative to
propose this request, if appropriate, in the next release of
Red Hat Enterprise Linux.

Comment 5 Zdeněk Pavlas 2013-12-16 16:19:31 UTC
This is a bug in the subclass.

class Error(YumBaseError):
    ...
    def __getattr__(self, name):
        if name == 'errmsg':
            return self.value
        # >>> implicit "return None" here <<<

The Error instance is passed to the logging module which checks if the argument is a non-empty dictionary with something like: "if e and type(e) == dict".

The first test checks for the presence of __len__ method and tries to call it, raising "NoneType is not callable" error in turn.  We have to make sure __len__ is not defined by raising an AttributeError in __getattr__.

Comment 6 Zdeněk Pavlas 2013-12-17 09:37:55 UTC
Created attachment 837608 [details]
Subclass YumBaseError without defining __len__ = None.

Comment 7 Milan Zázrivec 2013-12-17 11:41:49 UTC
*** Bug 996453 has been marked as a duplicate of this bug. ***

Comment 8 Stephen Herr 2014-03-27 16:49:16 UTC
There is no direct analogue for this bug for spacewalk client tools because these Spacewalk master commits obsolete it:
33666946
c9f19840

Comment 13 errata-xmlrpc 2014-09-16 00:25:14 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2014-1215.html