Bug 1397078 - jabber_lib.py: extract_traceback() does not retun proper traceback
Summary: jabber_lib.py: extract_traceback() does not retun proper traceback
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Spacewalk
Classification: Community
Component: Server
Version: 2.5
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Gennadii Altukhov
QA Contact: Red Hat Satellite QA List
URL:
Whiteboard:
Depends On:
Blocks: space27
TreeView+ depends on / blocked
 
Reported: 2016-11-21 14:34 UTC by Ales Dujicek
Modified: 2017-09-27 19:27 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-09-27 19:27:31 UTC


Attachments (Terms of Use)

Description Ales Dujicek 2016-11-21 14:34:26 UTC
Description of problem:

if I stop jabberd and restart osa-dispatcher I get error
ERROR: unhandled exception occurred: (unicode argument expected, got 'str').

it is caused by

/usr/share/rhn/osad/jabber_lib.py

which contains

try: # python 3
    from io import StringIO
    from osad.rhn_log import log_debug, log_error
except ImportError: # python 2
    from cStringIO import StringIO
    from rhn_log import log_debug, log_error

which never get to ImportError in python 2

# python
Python 2.7.12 (default, Sep 29 2016, 13:30:34) 
>>> from cStringIO import StringIO
>>> sio = StringIO()
>>> sio.write(u'unicode')
>>> sio.write('str')
>>> sio.getvalue()
'unicodestr'

>>> from io import StringIO
>>> sio = StringIO()
>>> sio.write(u'unicode')
7L
>>> sio.write('str')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unicode argument expected, got 'str'


Version-Release number of selected component (if applicable):
osa-common-5.11.71-1.el7.noarch

How reproducible:
always

Steps to Reproduce:
1. systemctl stop jabberd
2. systemctl restart osa-dispatcher
3. systemctl status osa-dispatcher -l

Actual results:
# systemctl status osa-dispatcher.service -l
● osa-dispatcher.service - OSA Dispatcher daemon
   Loaded: loaded (/usr/lib/systemd/system/osa-dispatcher.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Po 2016-11-21 05:36:51 EST; 6s ago
  Process: 21302 ExecStart=/usr/sbin/osa-dispatcher --pid-file /var/run/osa-dispatcher.pid (code=exited, status=255)
  Process: 21300 ExecStartPre=/bin/rm -f /var/run/osa-dispatcher.pid (code=exited, status=0/SUCCESS)
 Main PID: 27578 (code=exited, status=255)

lis 21 05:36:51 intel-waimeabay-hedt-01.ml3.eng.bos.redhat.com systemd[1]: Starting OSA Dispatcher daemon...
lis 21 05:36:51 intel-waimeabay-hedt-01.ml3.eng.bos.redhat.com osa-dispatcher[21302]: Spacewalk 21302 2016/11/21 05:36:51 -04:00: ('Error connecting to jabber server: Unable to connect to the host and port specified. See https://access.redhat.com/solutions/327903 for more information. ',)
lis 21 05:36:51 intel-waimeabay-hedt-01.ml3.eng.bos.redhat.com osa-dispatcher[21302]: Spacewalk 21302 2016/11/21 05:36:51 -04:00: ('Error caught:',)
lis 21 05:36:51 intel-waimeabay-hedt-01.ml3.eng.bos.redhat.com osa-dispatcher[21302]: ERROR: unhandled exception occurred: (unicode argument expected, got 'str').


Expected results:
# systemctl status osa-dispatcher.service -l
● osa-dispatcher.service - OSA Dispatcher daemon
   Loaded: loaded (/usr/lib/systemd/system/osa-dispatcher.service; enabled; vendor preset: disabled)
   Active: active (running) since Po 2016-11-21 05:45:32 EST; 13s ago
  Process: 21452 ExecStart=/usr/sbin/osa-dispatcher --pid-file /var/run/osa-dispatcher.pid (code=exited, status=0/SUCCESS)
  Process: 21450 ExecStartPre=/bin/rm -f /var/run/osa-dispatcher.pid (code=exited, status=0/SUCCESS)
 Main PID: 21455 (osa-dispatcher)
   CGroup: /system.slice/osa-dispatcher.service
           └─21455 /usr/bin/python -s /usr/sbin/osa-dispatcher --pid-file /var/run/osa-dispatcher.pid

lis 21 05:45:32 intel-waimeabay-hedt-01.ml3.eng.bos.redhat.com systemd[1]: Starting OSA Dispatcher daemon...
lis 21 05:45:32 intel-waimeabay-hedt-01.ml3.eng.bos.redhat.com osa-dispatcher[21452]: Spacewalk 21452 2016/11/21 05:45:32 -04:00: ('Error connecting to jabber server: Unable to connect to the host and port specified. See https://access.redhat.com/solutions/327903 for more information. ',)
lis 21 05:45:32 intel-waimeabay-hedt-01.ml3.eng.bos.redhat.com osa-dispatcher[21452]: Spacewalk 21452 2016/11/21 05:45:32 -04:00: ('Traceback (most recent call last):\n  File "/usr/share/rhn/osad/jabber_lib.py", line 266, in setup_connection\n    c = self._get_jabber_client(js)\n  File "/usr/share/rhn/osad/jabber_lib.py", line 338, in _get_jabber_client\n    c.connect()\n  File "/usr/share/rhn/osad/jabber_lib.py", line 612, in connect\n    raise socket.error(e)\nerror: Unable to connect to the host and port specified\n',)


Additional info:

Comment 1 Ales Dujicek 2016-11-21 14:36:34 UTC
pull request https://github.com/spacewalkproject/spacewalk/pull/474/commits

Comment 2 Gennadii Altukhov 2016-11-21 15:33:48 UTC
pull request was merged. spacewalk.git:
cca78e738c2ac6e98f14cc0d26df44212c79fec4

Comment 3 Eric Herget 2017-09-27 19:27:31 UTC
Spacewalk 2.7 has been released.

https://github.com/spacewalkproject/spacewalk/wiki/ReleaseNotes27


Note You need to log in before you can comment on or make changes to this bug.