Bug 1000145

Summary: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6
Product: Red Hat Enterprise Linux 6 Reporter: Marian Ganisin <mganisin>
Component: python-rhsmAssignee: Devan Goodwin <dgoodwin>
Status: CLOSED ERRATA QA Contact: John Sefler <jsefler>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.5CC: atodorov, bkearney, dgoodwin, jesusr, jgalipea
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: python-rhsm used a deprecated API. Consequence: DeprecationWarning message displayed to user. Fix: Changed how we raised the exception to avoid the DeprecationWarning. Result:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-11-21 21:27:53 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:    
Bug Blocks: 862910, 972747    
Attachments:
Description Flags
attachment for yum upgrade output and rhsm.log
none
attachment for yum upgrade output and rhsm.log (after fix) none

Description Marian Ganisin 2013-08-22 19:38:00 UTC
Description of problem:

I saw following message reported during yum upgrade testing:

/usr/lib/python2.6/site-packages/rhsm/certificate2.py:99: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6
  raise CertificateException(e.message)

Version-Release number of selected component (if applicable):
python-rhsm-1.9.3-1.el6

Comment 1 Alexander Todorov 2013-09-03 09:12:09 UTC
Seeing the same issue during upgrade:

  Cleanup    : tzdata-2012j-1.el6.noarch                                486/487 

  Cleanup    : libgcc-4.4.7-3.el6.x86_64                                487/487/usr/lib64/python2.6/site-packages/rhsm/certificate2.py:99: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6
  raise CertificateException(e.message)
 

  Verifying  : sudo-1.8.6p3-10.el6.x86_64                                 1/487

Comment 2 Devan Goodwin 2013-09-04 12:07:57 UTC
This unfortunately means there's a real exception being hidden here, if anyone sees a problem with this please report back with the stack trace from /var/log/rhsm/rhsm.log.

Comment 4 Devan Goodwin 2013-09-05 14:19:49 UTC
Fixed in python-rhsm.git: 88f65f367948b5cec0c5aefb43570ca95ea18070

Will appear in python-rhsm-1.11.1-1.

Comment 5 Bryan Kearney 2013-09-26 18:00:20 UTC
fixed in python-rhsm-1.9.5-1

Comment 6 John Sefler 2013-10-02 18:34:28 UTC
Created attachment 806672 [details]
attachment for yum upgrade output and rhsm.log

To reproduce the errors reported in comment 0 and comment 1, I provisioned a Released version of RHEL64 Server and then configured the following repo:

[root@jsefler-64 ~]# cat /etc/yum.repos.d/rel-eng.repo 
[nightly-8-23-rhel65]
name=RHEL6.5-20130823.n.0 Server from download.devel.redhat.com/nightly
baseurl=http://download.devel.redhat.com/nightly/RHEL6.5-20130823.n.0/6.5/Server/x86_64/os/
enabled=0
gpgcheck=0

Then I ran the following upgrade:
[root@jsefler-64 ~]# yum update --enablerepo=nightly-8-23-rhel65

<see attachment for yum upgrade output and rhsm.log>

The upgrade appears successful, but at the end of the yum Cleanups, this message was printed:
/usr/lib64/python2.6/site-packages/rhsm/certificate2.py:99: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6

The rhsm.log file contained this Traceback:


2013-10-02 12:54:34,370 [ERROR]  @rhsmcertd-worker:41 - Either the consumer is not registered or the certificates are corrupted. Certificate update using daemon failed.
2013-10-02 12:54:34,780 [ERROR]  @rhsmcertd-worker:41 - Either the consumer is not registered or the certificates are corrupted. Certificate update using daemon failed.
2013-10-02 13:05:54,149 [WARNING]  @productid.py:258 - Error loading productid metadata for nightly-8-23-rhel65.
2013-10-02 13:05:54,149 [WARNING]  @productid.py:258 - Error loading productid metadata for nightly-8-23-rhel65.
2013-10-02 13:05:54,151 [ERROR]  @productid.py:259 - find() takes at most 3 arguments (4 given)
Traceback (most recent call last):
  File "/usr/share/rhsm/subscription_manager/productid.py", line 253, in getEnabled
    if self._is_desktop(p):
  File "/usr/share/rhsm/subscription_manager/productid.py", line 270, in __getCert
    # known_repos is None means we have no repo info at all
  File "/usr/lib64/python2.6/site-packages/rhsm/certificate.py", line 64, in create_from_pem
    return _CertFactory().create_from_pem(pem)
  File "/usr/lib64/python2.6/site-packages/rhsm/certificate2.py", line 74, in create_from_pem
    return self._read_x509(_certificate.load(pem=pem), path, pem)
  File "/usr/lib64/python2.6/site-packages/rhsm/certificate2.py", line 99, in _read_x509
    raise CertificateException(e.message)
CertificateException: find() takes at most 3 arguments (4 given)
2013-10-02 13:05:54,151 [ERROR]  @productid.py:259 - find() takes at most 3 arguments (4 given)
Traceback (most recent call last):
  File "/usr/share/rhsm/subscription_manager/productid.py", line 253, in getEnabled
    if self._is_desktop(p):
  File "/usr/share/rhsm/subscription_manager/productid.py", line 270, in __getCert
    # known_repos is None means we have no repo info at all
  File "/usr/lib64/python2.6/site-packages/rhsm/certificate.py", line 64, in create_from_pem
    return _CertFactory().create_from_pem(pem)
  File "/usr/lib64/python2.6/site-packages/rhsm/certificate2.py", line 74, in create_from_pem
    return self._read_x509(_certificate.load(pem=pem), path, pem)
  File "/usr/lib64/python2.6/site-packages/rhsm/certificate2.py", line 99, in _read_x509
    raise CertificateException(e.message)
CertificateException: find() takes at most 3 arguments (4 given)

Comment 7 John Sefler 2013-10-02 20:35:59 UTC
Created attachment 806722 [details]
attachment for yum upgrade output and rhsm.log (after fix)

To test the fixed python-rhsm, I re-provisioned another Release version of RHEL64 Server and then configured the following two repos:

[root@jsefler-64b ~]# cat /etc/yum.repos.d/rel-eng.repo
[snap1-rhel65]
name=RHEL65 Snapshot-1 Server from download.devel.redhat.com/nightly
baseurl=http://download.devel.redhat.com/rel-eng/RHEL-6.5-Snapshot-1/6.5/Server/x86_64/os/
enabled=0
gpgcheck=0

[nightly-8-23-rhel65]
name=RHEL6.5-20130823.n.0 Server from download.devel.redhat.com/nightly
baseurl=http://download.devel.redhat.com/nightly/RHEL6.5-20130823.n.0/6.5/Server/x86_64/os/
enabled=0
gpgcheck=0

Now, let's install the fixed python-rhsm from repo snap1-rhel65...

[root@jsefler-64b ~]# yum update python-rhsm --enablerepo=snap1-rhel65
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
snap1-rhel65                                               | 3.9 kB     00:00     
snap1-rhel65/primary_db                                    | 3.1 MB     00:00     
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package python-rhsm.x86_64 0:1.1.8-1.el6 will be updated
---> Package python-rhsm.x86_64 0:1.9.6-1.el6 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================
 Package            Arch          Version               Repository           Size
==================================================================================
Updating:
 python-rhsm        x86_64        1.9.6-1.el6           snap1-rhel65        100 k

Transaction Summary
==================================================================================
Upgrade       1 Package(s)

Total download size: 100 k
Is this ok [y/N]: y
Downloading Packages:
python-rhsm-1.9.6-1.el6.x86_64.rpm                         | 100 kB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating   : python-rhsm-1.9.6-1.el6.x86_64                                 1/2 
  Cleanup    : python-rhsm-1.1.8-1.el6.x86_64                                 2/2 
snap1-rhel65/productid                                     | 1.7 kB     00:00     
  Verifying  : python-rhsm-1.9.6-1.el6.x86_64                                 1/2 
  Verifying  : python-rhsm-1.1.8-1.el6.x86_64                                 2/2 

Updated:
  python-rhsm.x86_64 0:1.9.6-1.el6                                                

Complete!
[root@jsefler-64b ~]# 


And now let's re-test an entire upgrade to nightly-8-23-rhel65 watching rhsm.log

<see attachment for yum upgrade output and rhsm.log (after fix)>


Reviewing the attachment (after fix) you will NOT see any DeprecationWarning.

Comment 11 John Sefler 2013-10-03 12:26:40 UTC
Note: The offending version of python-rhsm that threw the original DeprecationWarning was actually python-rhsm-1.1.8-1.el6 that was released in RHEL64.  Hence an upgrade from RHEL64 GA may continue to throw this error despite the fact that we are marking this bug as VERIFIED.  An upgrade from RHEL65 that will be released with python-rhsm-1.9.6-1.el6 (or newer) should no longer throw the DeprecationWarning.

Moving to VERIFIED.

Comment 12 errata-xmlrpc 2013-11-21 21:27:53 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-2013-1659.html