Bug 671014

Summary: python error in /etc/sysconfig/rhn/satellite-upgrade/recognize_guests.py
Product: Red Hat Satellite 5 Reporter: Tasos Papaioannou <tpapaioa>
Component: UpgradesAssignee: Justin Sherrill <jsherril>
Status: CLOSED ERRATA QA Contact: Jan Hutař <jhutar>
Severity: medium Docs Contact:
Priority: medium    
Version: 540CC: cperry, fnadge, jhutar, jsherril, mzazrivec, xdmoon
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: rhn-upgrade-5.4.0.22-1 Doc Type: Bug Fix
Doc Text:
Cause: What actions or circumstances cause this bug to present? Consequence: Previously,the recognize_guests.py script as a part of the Satellite upgrade procedure could fail in situations where the registered guest hardware information in the database lacked several smbios fields. Fix: What was done to fix the bug? Result: Running recognize_guests.py now no longer returns error in these circumstances. (this is not the same as the bug doesn’t present anymore)
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-02-10 09:00:27 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: 646488    

Description Tasos Papaioannou 2011-01-19 22:09:58 UTC
Description of problem:

If there are any systems registered to Satellite with no BIOS information stored in the system profile, then the entitlement-check.py satellite-upgrade script will fail:

# cd /etc/sysconfig/rhn/satellite-upgrade
# ./entitlement-check.py --rhn-cert=/<path>/<cert>

Traceback (most recent call last):
  File "./entitlement-check.py", line 312, in ?
    main()
  File "./entitlement-check.py", line 75, in main
    (to_convert, cant_convert) = recognize_guests.get_guest_lists()
  File "/etc/sysconfig/rhn/satellite-upgrade/recognize_guests.py", line 199, in get_guest_lists
    if virt_type is None and  smbios['smbios.bios.vendor'].lower() == 'xen':
AttributeError: 'NoneType' object has no attribute 'lower'


Changing recognize_guests.py to check for the existence of smbios['smbios.bios.vendor'] resolves the issue:

-    if virt_type is None and smbios['smbios.bios.vendor'].lower() == 'xen':
+    if virt_type is None and smbios['smbios.bios.vendor'] and smbios['smbios.bios.vendor'].lower() == 'xen':


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

rhn-upgrade-5.4.0.21-1.el5sat

How reproducible:

100% if flex guest candidates have no SMBIOS fields set.

Steps to Reproduce:

I don't know how it was originally caused on the customer database, but something like the following should do it:

1. Register a Red Hat Enterprise Linux 5.1 KVM or Xen guest to Satellite 5.3. The guest's host system should not be registered.

2. Delete the bios_vendor field value from the rhnServerDMI table in the Oracle database, for that system profile.

3. Install or update rhn-upgrade to the latest version, and run the script /etc/sysconfig/rhn/satellite-upgrade/entitlement-check.py --rhn-cert=/<path>/<cert>, where <cert> is a 5.4 certificate that includes flex guest entitlements.
  
Actual results:

The above traceback error.

Expected results:

No traceback error.

Additional info:

Comment 2 Justin Sherrill 2011-01-19 22:31:30 UTC
74986fcb50ed744f32428c89a26cbe78982848f9

Now handle null values correctly

Comment 3 Justin Sherrill 2011-01-19 22:32:18 UTC
e7c3d99a9a29a53066405e88f5d6d95f625b16fa

Handling an empty query properly now.

Comment 6 Florian Nadge 2011-02-07 14:19:25 UTC
Please be so kind and add a few key words to the field Technical Notes (Cause,
Consequence, Fix, Result) in this Bugzilla entry. In Future, you do not need to
write long explanations for the erratum if you answer these questions.

Many thanks,

Florian

Comment 7 Florian Nadge 2011-02-07 14:19:25 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause: What actions or circumstances cause this bug to present?

Consequence: What happens when the bug presents?

Fix: What was done to fix the bug?

Result: What now happens when the actions or circumstances above occur? (this is not the same as the bug doesn’t present anymore)

Comment 8 Milan Zázrivec 2011-02-07 14:58:38 UTC
Text that I added directly into the errata:

Previously, running recognize_guests.py script as a part of Satellite upgrade procedure might have failed with an error in situations where the registered guest hardware information in the database lacked several smbios fields. Running recognize_guests.py now no longer returns error in these circumstances.

Comment 9 Florian Nadge 2011-02-09 18:18:28 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1,7 +1,7 @@
 Cause: What actions or circumstances cause this bug to present?
 
-Consequence: What happens when the bug presents?
+Consequence: Previously,the recognize_guests.py script as a part of the Satellite upgrade procedure could fail in situations where the registered guest hardware information in the database lacked several smbios fields. 
 
 Fix: What was done to fix the bug?
 
-Result: What now happens when the actions or circumstances above occur? (this is not the same as the bug doesn’t present anymore)+Result: Running recognize_guests.py now no longer returns error in these circumstances.  (this is not the same as the bug doesn’t present anymore)

Comment 10 errata-xmlrpc 2011-02-10 09:00:27 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0208.html