This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 671014 - python error in /etc/sysconfig/rhn/satellite-upgrade/recognize_guests.py
python error in /etc/sysconfig/rhn/satellite-upgrade/recognize_guests.py
Status: CLOSED ERRATA
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Upgrades (Show other bugs)
540
All Linux
medium Severity medium
: ---
: ---
Assigned To: Justin Sherrill
Jan Hutař
:
Depends On:
Blocks: sat54-errata
  Show dependency treegraph
 
Reported: 2011-01-19 17:09 EST by Tasos Papaioannou
Modified: 2011-02-10 04:00 EST (History)
6 users (show)

See Also:
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 04:00:27 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Tasos Papaioannou 2011-01-19 17:09:58 EST
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 17:31:30 EST
74986fcb50ed744f32428c89a26cbe78982848f9

Now handle null values correctly
Comment 3 Justin Sherrill 2011-01-19 17:32:18 EST
e7c3d99a9a29a53066405e88f5d6d95f625b16fa

Handling an empty query properly now.
Comment 6 Florian Nadge 2011-02-07 09:19:25 EST
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 09:19:25 EST
    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 Zazrivec 2011-02-07 09:58:38 EST
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 13:18:28 EST
    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 04:00:27 EST
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

Note You need to log in before you can comment on or make changes to this bug.