Bug 824663

Summary: TypeError: 'NoneType' object is not callable
Product: Red Hat Enterprise Linux 5 Reporter: neil
Component: yumAssignee: packaging-team-maint
Status: CLOSED WONTFIX QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: low Docs Contact:
Priority: low    
Version: 5.8CC: aebenjam, jason.antonacci, jzeleny, lrossini, roland.breedveld, zpavlas
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-03-08 09:00:24 EST Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:

Description neil 2012-05-23 18:48:28 EDT
Description of problem:

Yum crashes instead of displaying the relevent error message.


Version-Release number of selected component (if applicable):
[root@SCMWEB ~]# rpm -qva|grep -i yum
yum-security-1.1.16-21.el5
yum-rhn-plugin-0.5.4-26.el5
yum-metadata-parser-1.1.2-3.el5
yum-updatesd-0.9-2.el5
yum-3.2.22-39.el5

How reproducible:


Steps to Reproduce:
1. Error condition on RHN server.
2. run "yum update"
3.
  
Actual results:

[root@SCMWEB ~]# yum update
Loaded plugins: rhnplugin, security
Traceback (most recent call last):
  File "/usr/bin/yum", line 29, in ?
    yummain.user_main(sys.argv[1:], exit_code=True)
  File "/usr/share/yum-cli/yummain.py", line 309, in user_main
    errcode = main(args)
  File "/usr/share/yum-cli/yummain.py", line 161, in main
    return exFatal(e)
  File "/usr/share/yum-cli/yummain.py", line 64, in exFatal
    logger.critical('\n\n%s', to_unicode(e))
  File "/usr/lib/python2.4/logging/__init__.py", line 1019, in critical
    apply(self._log, (CRITICAL, msg, args), kwargs)
  File "/usr/lib/python2.4/logging/__init__.py", line 1078, in _log
    record = self.makeRecord(self.name, level, fn, lno, msg, args, exc_info)
  File "/usr/lib/python2.4/logging/__init__.py", line 1064, in makeRecord
    return LogRecord(name, level, fn, lno, msg, args, exc_info)
  File "/usr/lib/python2.4/logging/__init__.py", line 226, in __init__
    if args and (len(args) == 1) and args[0] and (type(args[0]) ==
types.DictType):
TypeError: 'NoneType' object is not callable

Expected results:

[root@SCMWEB logging]# yum update
Loaded plugins: rhnplugin, security



Error Message:
    Abuse of Service detected for server Southridge.com (1022297826)
Error Class Code: 49
Error Class Info:
     You are getting this error because RHN has detected an abuse of
     service from this system and account. This error is triggered when
     your system makes too many connections to Red Hat Network. This
     error can not be triggered under a normal use of the Red Hat Network
     service as configured by default on Red Hat Linux.

     The Red Hat Network services for this system will remain disabled
     until you will reduce the RHN network traffic from your system to
     acceptable limits.

     Please log into RHN and visit https://rhn.redhat.com/help/contact.pxt
     to contact technical support if you think you have received this
     message in error.


Additional info:

Commenting the lines 226 and 227 from /usr/lib/python2.4/logging/__init__.py fixes the bug.  But we probably don't want that as the fix since it is a core Python file, yum should handle the error.
Comment 1 rbreedve 2012-08-14 05:07:35 EDT
same problem here on 64 bit
commented the 2 rows in /usr/lib64/python2.4/logging/__init__.py
after that account is blokked with code 49
Comment 2 Jason Antonacci 2013-01-03 13:03:12 EST
SOLVED - Server did not have a valid RHN subscription.  Ran "rhn_register --nox -v" and successfully registered with Red Hat Network.  Command "yum update" ran w/o errors.

Was Experiencing Bug 824663 - "TypeError: 'NoneType' object is not callable". Could reproduce yum error on RHEL 5.8 x86_64 for line 226 of file "/usr/lib64/python2.4/logging/__init__.py". Commenting out lines 226 and 227 permitted yum error to properly display.

Ciao,
Jason

# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.8 (Tikanga)

# uname -s -r -v -m -p -i -o
Linux 2.6.18-308.20.1.el5 #1 SMP Tue Nov 6 04:38:29 EST 2012 x86_64 x86_64 x86_64 GNU/Linux

# rpm -qa | grep "\(^yum\|^python-[0-9]\)"
python-2.4.3-46.el5_8.2
yum-updatesd-0.9-2.el5
yum-metadata-parser-1.1.2-3.el5
yum-security-1.1.16-21.el5
yum-3.2.22-39.el5
yum-rhn-plugin-0.5.4-26.el5

# yum update
Loaded plugins: rhnplugin, security
Traceback (most recent call last):
  File "/usr/bin/yum", line 29, in ?
    yummain.user_main(sys.argv[1:], exit_code=True)
  File "/usr/share/yum-cli/yummain.py", line 309, in user_main
    errcode = main(args)
  File "/usr/share/yum-cli/yummain.py", line 161, in main
    return exFatal(e)
  File "/usr/share/yum-cli/yummain.py", line 64, in exFatal
    logger.critical('\n\n%s', to_unicode(e))
  File "/usr/lib64/python2.4/logging/__init__.py", line 1019, in critical
    apply(self._log, (CRITICAL, msg, args), kwargs)
  File "/usr/lib64/python2.4/logging/__init__.py", line 1078, in _log
    record = self.makeRecord(self.name, level, fn, lno, msg, args, exc_info)
  File "/usr/lib64/python2.4/logging/__init__.py", line 1064, in makeRecord
    return LogRecord(name, level, fn, lno, msg, args, exc_info)
  File "/usr/lib64/python2.4/logging/__init__.py", line 226, in __init__
    if args and (len(args) == 1) and args[0] and (type(args[0]) == types.DictType):
TypeError: 'NoneType' object is not callable

# cp /usr/lib64/python2.4/logging/__init__.py{,.`date +%Y%m%d-%H%M%S%N`}
# vim "/usr/lib64/python2.4/logging/__init__.py"

# yum update
Loaded plugins: rhnplugin, security



Error Message:
    Abuse of Service detected for server [REDACTED] (1023839447)
Error Class Code: 49
Error Class Info:
     You are getting this error because RHN has detected an abuse of
     service from this system and account. This error is triggered when
     your system makes too many connections to Red Hat Network. This
     error can not be triggered under a normal use of the Red Hat Network
     service as configured by default on Red Hat Linux.

     The Red Hat Network services for this system will remain disabled
     until you will reduce the RHN network traffic from your system to
     acceptable limits.

     Please log into RHN and visit https://rhn.redhat.com/help/contact.pxt
     to contact technical support if you think you have received this
     message in error.
Comment 3 Jason Antonacci 2013-01-03 14:11:41 EST
Apologies.  While my (re)running rhn_register does resolve the inability to successfully run yum, it only masks the code problem.  It does not address the root cause: a yum and/or python object issue. If I could find a way, I'd update my posting.

Sincerely,
Jason
Comment 4 Jan Zeleny 2013-01-07 05:02:11 EST
Considering there is a workaround and the issue is not critical, I'm updating priority and severity to low. If you want, you can escalate this issue via Red Hat Customer Portal.
Comment 5 Zdeněk Pavlas 2013-03-08 09:00:24 EST
Probably a bug in the logging module, triggered when to_unicode(e) returns a specific exception instance, instead of a string.  We could work this around in Yum, but it seems difficult to reproduce and low priority, so I'm closing it.
Comment 6 Adam Benjamin 2013-06-26 11:09:14 EDT
I accidentally created this same problem and then realized the cause.  I had expected that the process of registering with our RHN proxy would copy the certificate into some special location - but I discovered it was using it from the directory I uploaded it to.  (Root's home directory.)  When I restored the certificate, yum's proper operation resumed.

So  1) it should have produced a nicer error and
    2) in my opinion it should have copied the cert to a better location

I hope that helps someone else who stumbles across the same issue.

Adam