rhnreg_ks command executed in %post fails with : Error reading hardware information: dbus_bindings.DBusException Error reading DMI information: dbus_bindings.DBusException Under %post : dbus-daemon is stopped hald is stopped we need to fix this in master and backport it to spacewalk 0.6
Created attachment 358053 [details] rhnreg.py patch to manage Dbus exception Hi, I've used the same code of hardware.py to manage exception, when it tries to get SMBIOS information and hal/dbus aren't running ... Marco Giunta
Created attachment 358125 [details] Alternative patch Since other failures to read smbios info only result in a log message, seems reasonable that a failure to connect to HAL/DBUS should only result in a log message
After the commit of the patch (08/20/09 17:47:37), now there is another problem: if I try to register a pc during kickstart, appears another error message: Traceback (most recent call last): File "/usr/sbin/rhnreg_ks", line 216, in ? cli.run() File "/usr/share/rhn/up2date_client/rhncli.py", line 65, in run sys.exit(self.main() or 0) File "/usr/sbin/rhnreg_ks", line 145, in main other = other) File "/usr/share/rhn/up2date_client/rhnreg.py", line 431, in registerSystem ret = s.registration.new_system(auth_dict) File "/usr/share/rhn/up2date_client/rhnserver.py", line 50, in __call__ return rpcServer.doCall(method, *args, **kwargs) File "/usr/share/rhn/up2date_client/rpcServer.py", line 199, in doCall ret = method(*args, **kwargs) File "/usr/lib/python2.4/xmlrpclib.py", line 1096, in __call__ return self.__send(self.__name, args) File "/usr/share/rhn/up2date_client/rpcServer.py", line 38, in _request1 ret = self._request(methodname, params) File "/usr/lib/python2.4/site-packages/rhn/rpclib.py", line 318, in _request request = self._req_body(params, methodname) File "/usr/lib/python2.4/site-packages/rhn/rpclib.py", line 222, in _req_body return xmlrpclib.dumps(params, methodname, encoding=self._encoding) File "/usr/lib/python2.4/xmlrpclib.py", line 1029, in dumps data = m.dumps(params) File "/usr/lib/python2.4/xmlrpclib.py", line 603, in dumps dump(v, write) File "/usr/lib/python2.4/xmlrpclib.py", line 615, in __dump f(self, value, write) File "/usr/lib/python2.4/xmlrpclib.py", line 696, in dump_struct dump(v, write) File "/usr/lib/python2.4/xmlrpclib.py", line 615, in __dump f(self, value, write) File "/usr/lib/python2.4/xmlrpclib.py", line 619, in dump_nil raise TypeError, "cannot marshal None unless allow_none is enabled" exceptions.TypeError: cannot marshal None unless allow_none is enabled This error appears because when the function get_hal_smbios() in hardware.py raise the exception, doesn't return an empty smbios{} dict, but return nothing. Instead of a 'return', set an empty props{} dict, so the function can end with a empty smbios{} dict: def get_hal_smbios(): try: computer = get_hal_computer() props = computer.GetAllProperties() except: log = up2dateLog.initLog() msg = "Error reading smbios information: %s\n" % (sys.exc_type) log.log_debug(msg) # return props = {} <<<<<<<------------ smbios = {}
Created attachment 358436 [details] Fix TypeError "cannot marshal None" Returning None seems, fine, but we shouldn't then be adding it to the hashmap
Looks like actually this will show up in multiple places
Created attachment 358440 [details] Fix TypeError "cannot marshal None"
Pradeep, While it looks like we're going to try to ensure HAL/DBUS is running https://bugzilla.redhat.com/show_bug.cgi?id=518342, I stil think my patch is worth applyint... The reason it covers more than one function is that get_hal_smbios, *may* return None, which will then cause a TypeException, which will be a real PITA to diagnose. Either get_hal_smbios should throw an exception, or we need to trap the Nones before they get into the RPC calls.
I'll look into this. Don't think I can today though but hopefully sometime this week.
Fixed! commit 4575224ad3f7bf8293e3d77eccf4a0415f356603 So Mark, I reviewed you're patch and don't see any major issues with it. But in comment#4 the cause is due to xmlrpc's restriction on None values in the hash while sending across. So instead of checking and skipping smbios from the dictionary and making separate rpc call I just did, diff --git a/client/rhel/rhn-client-tools/src/up2date_client/hardware.py b/client/rhel/rhn-cl index 4dff5c9..115bce8 100644 --- a/client/rhel/rhn-client-tools/src/up2date_client/hardware.py +++ b/client/rhel/rhn-client-tools/src/up2date_client/hardware.py @@ -865,7 +865,7 @@ def get_hal_system_and_smbios(): log = up2dateLog.initLog() msg = "Error reading system and smbios information: %s\n" % (sys.exc_type) log.log_debug(msg) - return + return {} system_and_smbios = {} for key in props: @@ -882,7 +882,7 @@ def get_hal_smbios(): log = up2dateLog.initLog() msg = "Error reading smbios information: %s\n" % (sys.exc_type) log.log_debug(msg) - return + return {} smbios = {} for key in props: if key.startswith('smbios'): with fix: $ rhnreg_ks --server http://localhost/XMLRPC --user admin --pass xxxxx --force ZZZZZZZZZZZZZZZZ {'username': 'admin', 'release_name': 'redhat-release', 'profile_name': 'localhost', 'architecture': 'i686-redhat-linux', 'os_release': '5Server', 'smbios': {}, 'password': 'xxxxx'} $ so smbios instead of being 'None' would now be an empty dict which is what its suppose to be if it could not get that info.
Same issue occurs on rhn-setup-0.4.20-9.el5.noarch.rpm (RHEL 5.4 final) while trying to execute rhnreg_ks during kickstart process. Best Regards Marcus
(In reply to comment #11) > Same issue occurs on rhn-setup-0.4.20-9.el5.noarch.rpm (RHEL 5.4 final) while > trying to execute rhnreg_ks during kickstart process. > > Best Regards > Marcus Should using the --nohardware flag for rhnreg_ks sidestep this problem? It doesn't seem to have an effect.
#11 - that has been fixed under BZ 495680 This should be fixed now.