Bug 1395794

Summary: /usr/libexec/rhsmd is failing with ImportError: No module named decorator
Product: Red Hat Enterprise Linux 6 Reporter: John Sefler <jsefler>
Component: subscription-managerAssignee: Chris Snyder <csnyder>
Status: CLOSED ERRATA QA Contact: John Sefler <jsefler>
Severity: medium Docs Contact:
Priority: urgent    
Version: 6.9CC: csnyder, redakkan, skallesh, vrjain
Target Milestone: rcKeywords: Regression, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-03-21 10:57:26 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:

Description John Sefler 2016-11-16 16:52:34 UTC
Description of problem:
On a freshly provisioned RHEL6.9 system, /usr/libexec/rhsmd is exiting early because it fails to import decorator which is provided by package python-decorator which does not appear to be installed by default anymore.

Bottom line: if subscription-manager needs the decorator module, then the spec file should require python-decorator.


Version-Release number of selected component (if applicable):
[root@ibm-z-24 ~]# rpm -q --whatprovides /usr/libexec/rhsmd
subscription-manager-1.18.4-1.el6.s390x


How reproducible:


Steps to Reproduce:
[root@ibm-z-24 ~]# /usr/libexec/rhsmd --help
[root@ibm-z-24 ~]# 

Actual results:
  no response

Expected results:
  the Usage statement and a list of Options.

Additional info:

[root@ibm-z-24 ~]# python -i /usr/libexec/rhsmd
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/libexec/rhsmd", line 33, in excepthook_base
    sys.exit(0)
SystemExit: 0

Original exception was:
Traceback (most recent call last):
  File "/usr/libexec/rhsmd", line 41, in <module>
    import decorator
ImportError: No module named decorator
>>> quit()
[root@ibm-z-24 ~]# 



[root@ibm-z-24 ~]# rpm -q subscription-manager --requires | grep python
/usr/bin/python  
dbus-python  
python(abi) = 2.6
python-dateutil  
python-ethtool  
python-iniparse  
python-rhsm >= 1.18.1
^^^^^^^^^^^
That list should also include python-decorator

Comment 2 John Sefler 2016-11-16 18:54:07 UTC
[root@ibm-z-24 ~]# /usr/libexec/rhsmd --help
[root@ibm-z-24 ~]# echo $?
0

^ a successful exitCode of 0 when rhsmd actually failed to load a python module feels wrong too.

Comment 4 John Sefler 2016-11-17 19:59:17 UTC
Here is another reason why we need python-decorator installed.  Without it, the following DBusException is being thrown to rhsm.log during register, unregister, and probably more modules...

2016-11-17 13:46:02,127 [DEBUG] subscription-manager:1731:MainThread @dbus_interface.py:46 - Unable to connect to dbus
2016-11-17 13:46:02,127 [ERROR] subscription-manager:1731:MainThread @dbus_interface.py:47 - org.freedesktop.DBus.Error.TimedOut: Activation of com.redhat.SubscriptionManager timed out
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/subscription_manager/dbus_interface.py", line 36, in __init__
    follow_name_owner_changes=self.has_main_loop)
  File "/usr/lib/python2.6/site-packages/subscription_manager/dbus_interface.py", line 69, in _get_validity_object
    return self.bus.get_object(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/dbus/bus.py", line 244, in get_object
    follow_name_owner_changes=follow_name_owner_changes)
  File "/usr/lib/python2.6/site-packages/dbus/proxies.py", line 241, in __init__
    self._named_service = conn.activate_name_owner(bus_name)
  File "/usr/lib/python2.6/site-packages/dbus/bus.py", line 183, in activate_name_owner
    self.start_service_by_name(bus_name)
  File "/usr/lib/python2.6/site-packages/dbus/bus.py", line 281, in start_service_by_name
    'su', (bus_name, flags)))
  File "/usr/lib/python2.6/site-packages/dbus/connection.py", line 630, in call_blocking
    message, timeout)
DBusException: org.freedesktop.DBus.Error.TimedOut: Activation of com.redhat.SubscriptionManager timed out

Comment 5 Chris Snyder 2016-11-21 19:22:47 UTC
Adding a PR for the upstream fix.

Comment 7 Shwetha Kallesh 2016-11-28 08:51:56 UTC
Reproducer:

[root@ibm-z10-78 ~]# /usr/libexec/rhsmd --help
[root@ibm-z10-78 ~]# python -i /usr/libexec/rhsmd
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/libexec/rhsmd", line 33, in excepthook_base
    sys.exit(0)
SystemExit: 0

Original exception was:
Traceback (most recent call last):
  File "/usr/libexec/rhsmd", line 41, in <module>
    import decorator
ImportError: No module named decorator
>>> 
[root@ibm-z10-78 ~]# rpm -q subscription-manager --requires | grep python
/usr/bin/python  
dbus-python  
python(abi) = 2.6
python-dateutil  
python-ethtool  
python-iniparse  
python-rhsm >= 1.18.1


Verification:

[root@ibm-z10-78 ~]# /usr/libexec/rhsmd --helpUsage: rhsmd [OPTIONS]

Options:
  -h, --help            show this help message and exit
  -d, --debug           Display debug messages
  -k, --keep-alive      Stay running (don't shut down after the first dbus
                        call)
  -s, --syslog          Run standalone and log result to syslog
  -f FORCE_SIGNAL, --force-signal=FORCE_SIGNAL
                        Force firing of a signal (valid, expired, warning,
                        partial, classic or registration_required)
  -i, --immediate       Fire forced signal immediately (requires --force-
                        signal)
[root@ibm-z10-78 ~]# rpm -q subscription-manager --requires | grep python/usr/bin/python  
dbus-python  
python(abi) = 2.6
python-dateutil  
python-decorator  
python-ethtool  
python-iniparse  
python-rhsm >= 1.18.1


[root@ibm-z10-78 ~]# rpm -q --whatprovides /usr/libexec/rhsmd
subscription-manager-1.18.5-1.el6.s390x

Comment 9 errata-xmlrpc 2017-03-21 10:57:26 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.

https://rhn.redhat.com/errata/RHSA-2017-0698.html