Description of problem: I have system with +- minimal installation of RHEL5 with client tools updated from Spacewalk 1.6-client repo. When I'm registering to Spacewalk (1.6 on RHEL5), error message mentioning SubscriptionManager appears. Anyway, exit code is 0, so this is just a minor issue. Version-Release number of selected component (if applicable): # rpm -qa | grep -i -e subscription -e rhsm # rpm -q rhn-client-tools rhn-client-tools-1.6.47-1.el5 How reproducible: 1 of 1 Steps to Reproduce: 1. Try to register to Spacewalk with subscription-manager not installed # rhnreg_ks --force --username=user --password=pass Introspect error: The name com.redhat.SubscriptionManager was not provided by any .service files Actual results: Error message appears. Expected results: Error message should be hidden. Additional info: # grep 'com.redhat.SubscriptionManager' `rpm -ql rhn-client-tools rhn-setup` /usr/share/rhn/up2date_client/rhnreg.py: validity_obj = bus.get_object('com.redhat.SubscriptionManager', /usr/share/rhn/up2date_client/rhnreg.py: dbus_interface='com.redhat.SubscriptionManager.EntitlementStatus')
The problem is caused by code def _introspect_error_handler(self, error): self._introspect_state = self.INTROSPECT_STATE_DONT_INTROSPECT self._introspect_execute_queue() sys.stderr.write("Introspect error: " + str(error) + "\n") in /usr/lib/python2.4/site-packages/dbus/proxies.py. Modules should just raise exception, sadly here they insist on also writing to stderr.
Possible patch #1: diff --git a/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py b/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py index 8d2b640..5eb39b0 100644 --- a/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py +++ b/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py @@ -351,6 +351,12 @@ def registerSystem(username = None, password = None, return ret +class EatSTDERR: + def __init__(self): + pass + def write(self, data): + pass + def updateRhsmStatus(): try: bus = dbus.SystemBus() @@ -363,13 +369,20 @@ def updateRhsmStatus(): # install. we can't do anything here, so just ignore it. return + orig_sys_stderr = sys.stderr try: + sys.stderr = EatSTDERR() validity_iface.check_status() + sys.stderr = orig_sys_stderr except dbus.DBusException: + sys.stderr = orig_sys_stderr # the call timed out, or something similar. we don't really care # about a timely reply or what the result might be, we just want # the method to run. So we can safely ignore this. pass + except Exception: + sys.stderr = orig_sys_stderr + raise def getAvailableChannels(username, password):
Possible patch #2: diff --git a/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py b/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py index 8d2b640..9fe2cb1 100644 --- a/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py +++ b/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py @@ -354,8 +354,8 @@ def registerSystem(username = None, password = None, def updateRhsmStatus(): try: bus = dbus.SystemBus() - validity_obj = bus.get_object('com.redhat.SubscriptionManager', - '/EntitlementStatus') + validity_obj = bus.ProxyObjectClass(bus, 'com.redhat.SubscriptionManager', + '/EntitlementStatus', introspect=False) validity_iface = dbus.Interface(validity_obj, dbus_interface='com.redhat.SubscriptionManager.EntitlementStatus') except dbus.DBusException:
Jan, is this also a regression in RHEL 5.8?
The minimal reproducer is PYTHONPATH=/usr/share/rhn python -c 'from up2date_client import rhnreg; rhnreg.updateRhsmStatus();'
I went with the patch from comment 3, Spacewalk master, 0b0853a6a0f6064e4150e9e6d64c426374775069.
Spacewalk 1.7 has been released: https://fedorahosted.org/spacewalk/wiki/ReleaseNotes17