Bug 743407

Summary: API system.getDmi() returns a traceback when BIOS field is null into database
Product: [Community] Spacewalk Reporter: Marcelo Moreira de Mello <mmello>
Component: APIAssignee: Jan Pazdziora (Red Hat) <jpazdziora>
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 1.6CC: jpazdziora, mmello
Target Milestone: ---Keywords: Patch
Target Release: ---   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: spacewalk-java-1.6.57-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 743434 (view as bug list) Environment:
Last Closed: 2011-12-22 16:47:24 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:
Bug Depends On:    
Bug Blocks: 723481    
Attachments:
Description Flags
patch proposed
none
patch proposed
none
patch proposed none

Description Marcelo Moreira de Mello 2011-10-04 19:53:15 UTC
+++ This bug was initially created as a clone of Bug #741476 +++

Description of problem:
API system.getDmi() method does not return any value if some row at DB is null 


Version-Release number of selected component (if applicable):
Spacewalk 1.6 Nightly Version


How reproducible:
100%


Steps to Reproduce:
 
  Reproducer available at BZ#741476

+++++++++++++++++++++++=


# python api-dmi.py

 { .. SNIP .. }

1000010003
{'product': '', 'vendor': '', 'bios_vendor': '', 'system': 'SYSTEM_MANUAL_FILLED', 'bios_release': '', 'board': '', 'bios_version': '1.17', 'asset': ''}
********************

  Changing DB: 

SQL> update rhnserverdmi set BIOS_VERSION = '' where SERVER_ID = 1000010003;

1 row updated.


SQL> select ID, BIOS_VENDOR, BIOS_VERSION, BIOS_RELEASE from rhnserverdmi where SERVER_ID = 1000010003;

	ID BIOS_VENDOR			  BIOS_VERSION	       BIOS_RELEASE
---------- ------------------------------ -------------------- ---------------
       184

SQL> select ID, SERVER_ID, VENDOR, SYSTEM, PRODUCT from rhnserverdmi whereSERVER_ID = 1000010003;  

	ID  SERVER_ID VENDOR			     SYSTEM				      PRODUCT
---------- ---------- ------------------------------ ---------------------------------------- --------------------------------------------------
       184 1000010003				     SYSTEM_MANUAL_FILLED

=================// ===================// =========

Executing python script: 


# python api-dmi.py

 { .. SNIP .. }

Traceback (most recent call last):
  File "api-dmi.py", line 12, in <module>
    sys_dmi = server.system.getDmi(token,int(system['id']))
  File "/usr/lib64/python2.7/xmlrpclib.py", line 1224, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib64/python2.7/xmlrpclib.py", line 1570, in __request
    verbose=self.__verbose
  File "/usr/lib64/python2.7/xmlrpclib.py", line 1264, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/lib64/python2.7/xmlrpclib.py", line 1297, in single_request
    return self.parse_response(response)
  File "/usr/lib64/python2.7/xmlrpclib.py", line 1462, in parse_response
    p.feed(data)
  File "/usr/lib64/python2.7/xmlrpclib.py", line 557, in feed
    self._parser.Parse(data, 0)
xml.parsers.expat.ExpatError: XML or text declaration not at start of entity: line 1, column 76

Comment 1 Marcelo Moreira de Mello 2011-10-04 19:53:47 UTC
Taking...

Comment 2 Marcelo Moreira de Mello 2011-10-04 22:20:40 UTC
Created attachment 526336 [details]
patch proposed

 Hello, 

 Follow a patch addressed to this BZ. Created an test package and worked as
expected.

 Patch already sent to spacewalk-devel maillist 

   Mail Thread: 
     https://www.redhat.com/archives/spacewalk-devel/2011-October/msg00001.html

 Best, 
mmello

Comment 3 Marcelo Moreira de Mello 2011-10-05 20:16:07 UTC
Created attachment 526571 [details]
patch proposed


 Better looking patch

Comment 4 Marcelo Moreira de Mello 2011-10-06 23:29:22 UTC
Created attachment 526818 [details]
patch proposed

Hello, 

  Mail thread -> https://www.redhat.com/archives/spacewalk-devel/2011-October/msg00009.html

Comment 5 Jan Pazdziora (Red Hat) 2011-10-10 08:26:26 UTC
Fixed in Spacewalk master, 6742bdedf6669d146316da043048ab16f0862ca9.

Comment 6 Milan Zázrivec 2011-12-22 16:47:24 UTC
Spacewalk 1.6 has been released.