Bug 614963

Summary: Python 2.6 deprecation of BaseException.message
Product: Red Hat Enterprise Linux 6 Reporter: Jan Pokorný [poki] <jpokorny>
Component: luciAssignee: Ryan McCabe <rmccabe>
Status: CLOSED ERRATA QA Contact: Cluster QE <mspqa-list>
Severity: low Docs Contact:
Priority: low    
Version: 6.0CC: bbrock, cluster-maint, rmusil
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: luci-0.23.0-1.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-19 13:56:07 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:

Description Jan Pokorný [poki] 2010-07-15 16:21:31 UTC
I got such warnings randomly while playing around with luci, latest version in GIT (from Tue Jul 13 15:35:23 2010 -0500).

GIT: http://git.fedorahosted.org/git/luci.git

Files + line-numbers where the problem was encountered:
luci/lib/ricci_communicator.py:58
luci/lib/async_helpers.py:38

grep'd expected places which should be review:
$ grep -FRn .message . | grep -v .git/hooks | sed -e 's/: \+/:\t\t /g'
./luci/lib/async_helpers.py:38:		 return { 'errors':		 [ _('Unable to connect to host "%s":		 %s') % (host, e.message) ] }
./luci/lib/ricci_communicator.py:58:		 if e.message:
./luci/lib/ricci_communicator.py:60:		 % (self.__hostname, self.__port, e.message)
./luci/lib/ricci_communicator.py:206:		 % (self.__hostname, self.__port, e.message)
./luci/lib/ricci_communicator.py:241:		 % (self.__hostname, self.__port, e.message)
./luci/lib/ricci_communicator.py:389:		 if e.message:
./luci/lib/ricci_communicator.py:391:		 % (self.__hostname, self.__port, e.message)
./luci/lib/ricci_communicator.py:429:		 if e.message:
./luci/lib/ricci_communicator.py:431:		 % (self.__hostname, self.__port, e.message)
./build/lib/luci/lib/async_helpers.py:38:		 return { 'errors':		 [ _('Unable to connect to host "%s":		 %s') % (host, e.message) ] }
./build/lib/luci/lib/ricci_communicator.py:58:		 if e.message:
./build/lib/luci/lib/ricci_communicator.py:60:		 % (self.__hostname, self.__port, e.message)
./build/lib/luci/lib/ricci_communicator.py:206:		 % (self.__hostname, self.__port, e.message)
./build/lib/luci/lib/ricci_communicator.py:241:		 % (self.__hostname, self.__port, e.message)
./build/lib/luci/lib/ricci_communicator.py:389:		 if e.message:
./build/lib/luci/lib/ricci_communicator.py:391:		 % (self.__hostname, self.__port, e.message)
./build/lib/luci/lib/ricci_communicator.py:429:		 if e.message:
./build/lib/luci/lib/ricci_communicator.py:431:		 % (self.__hostname, self.__port, e.message)

Possible solution:
Using ``args'' attribute of BaseException? See PEP 352 [1].

Note:
In Python 2.7, ``message'' attribute is removed [1].

References:
[1] http://www.python.org/dev/peps/pep-0352/

Comment 2 Jan Pokorný [poki] 2010-07-15 16:29:04 UTC
Pardon, obviously, the command and output should look like this (build dir brings duplicities):

$ grep -FRn .message . | grep -Fv -e .git/hooks -e ./build | sed -e 's/: \+/:  /g'
./luci/lib/async_helpers.py:38:  return { 'errors':  [ _('Unable to connect to host "%s":  %s') % (host, e.message) ] }
./luci/lib/ricci_communicator.py:58:  if e.message:
./luci/lib/ricci_communicator.py:60:  % (self.__hostname, self.__port, e.message)
./luci/lib/ricci_communicator.py:206:  % (self.__hostname, self.__port, e.message)
./luci/lib/ricci_communicator.py:241:  % (self.__hostname, self.__port, e.message)
./luci/lib/ricci_communicator.py:389:  if e.message:
./luci/lib/ricci_communicator.py:391:  % (self.__hostname, self.__port, e.message)
./luci/lib/ricci_communicator.py:429:  if e.message:
./luci/lib/ricci_communicator.py:431:  % (self.__hostname, self.__port, e.message)

Comment 3 RHEL Program Management 2010-07-15 16:37:44 UTC
This issue has been proposed when we are only considering blocker
issues in the current Red Hat Enterprise Linux release. It has
been denied for the current Red Hat Enterprise Linux release.

** If you would still like this issue considered for the current
release, ask your support representative to file as a blocker on
your behalf. Otherwise ask that it be considered for the next
Red Hat Enterprise Linux release. **

Comment 4 RHEL Program Management 2010-07-16 14:17:34 UTC
This issue has been proposed when we are only considering blocker
issues in the current Red Hat Enterprise Linux release. It has
been denied for the current Red Hat Enterprise Linux release.

** If you would still like this issue considered for the current
release, ask your support representative to file as a blocker on
your behalf. Otherwise ask that it be considered for the next
Red Hat Enterprise Linux release. **

Comment 5 Brian Brock 2010-07-23 17:14:09 UTC
Is there an error message that should replace this behavior?  I don't know which way the API changed and how luci should change, so I'm unsure what behavior to look for as an improvement.

Comment 6 Jan Pokorný [poki] 2010-07-30 13:42:16 UTC
(In reply to comment #5)
> Is there an error message that should replace this behavior?  I don't know
> which way the API changed and how luci should change, so I'm unsure what
> behavior to look for as an improvement.    

One of the ways how to reproduce it:
1. in Luci at the "Manage Clusters" section, select "Add" to open "Add an Existing Cluster"
2. fill "Node Hostname" field with not-existing hostname, fill the password and click "Connect"
3. in the log (e.g. console if you run luci in foreground), block of messages like this will appear (and at the same time the user is correctly informed that the connection cannot be established in the GUI) -- among them there is also that deprecation warning:

---snip---
../luci/lib/ricci_communicator.py:58: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6
  if e.message:
15:27:29,270 ERROR [luci.lib.ricci_communicator] Unable to establish an SSL connection to not.existing.cluster:11111: Name or service not known
Traceback (most recent call last):
  File "../luci/lib/ricci_communicator.py", line 42, in __init__
    0, socket.AI_PASSIVE):
gaierror: [Errno -2] Name or service not known
../luci/lib/async_helpers.py:38: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6
  return { 'errors': [ _('Unable to connect to host "%s": %s') % (host, e.message) ] }
---snip---

Fixing this bug means removing that deprecation warning ~ making step for Luci to be compatible with Python 2.7.

Comment 7 Jan Pokorný [poki] 2010-08-27 19:54:18 UTC
This should be fixed in http://git.fedorahosted.org/git/?p=luci.git;a=commit;h=5efb11dae9a80b94ed9283b8fbe0b1c53af7166d

Comment 15 errata-xmlrpc 2011-05-19 13:56:07 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0655.html