RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1198369 - UnboundLocalError: local variable 'state' referenced before assignment
Summary: UnboundLocalError: local variable 'state' referenced before assignment
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: subscription-manager
Version: 6.7
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: rc
: ---
Assignee: Chris "Ceiu" Rog
QA Contact: John Sefler
URL:
Whiteboard:
Depends On:
Blocks: rhsm-rhel67
TreeView+ depends on / blocked
 
Reported: 2015-03-03 22:21 UTC by John Sefler
Modified: 2015-07-22 06:53 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-07-22 06:53:26 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:1345 0 normal SHIPPED_LIVE subscription-manager and python-rhsm bug fix and enhancement update 2015-07-20 17:59:53 UTC

Description John Sefler 2015-03-03 22:21:30 UTC
Description of problem:
Encountering a traceback with the scenario presented below against a standalone candlepin server with TESTDATA deployed

Version-Release number of selected component (if applicable):
[root@jsefler-os6 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 0.9.45-1
subscription management rules: 5.14
subscription-manager: 1.14.1-1.el6
python-rhsm: 1.14.1-1.el6


How reproducible:
not always

Steps to Reproduce:
[root@jsefler-os6 ~]# subscription-manager register --username=testuser1 --org=admin
Password: 
The system has been registered with ID: 4815e98f-978f-4c61-ba1d-e4a21bb3cebe 
[root@jsefler-os6 ~]# 
[root@jsefler-os6 ~]# subscription-manager list --installed

+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
Product Name:   Awesome OS Server Bits
Product ID:     37060
Version:        6.1
Arch:           ALL
Status:         Not Subscribed
Status Details: Not supported by a valid subscription.
Starts:         
Ends:           

[root@jsefler-os6 ~]# subscription-manager facts | grep is_guest
virt.is_guest: True
[root@jsefler-os6 ~]# 
[root@jsefler-os6 ~]# subscription-manager list --all --avail --matches "*data center*"
+-------------------------------------------+
    Available Subscriptions
+-------------------------------------------+
Subscription Name:   Awesome OS Server Basic (data center)
Provides:            
SKU:                 awesomeos-server-basic-dc
Contract:            4
Pool ID:             8a9087e34bdb9471014bdb954f5f05e0
Provides Management: No
Available:           5
Suggested:           1
Service Level:       None
Service Type:        Self-Support
Subscription Type:   Standard
Ends:                02/29/2016
System Type:         Physical

Subscription Name:   Awesome OS Server Basic (data center)
Provides:            
SKU:                 awesomeos-server-basic-dc
Contract:            4
Pool ID:             8a9087e34bdb9471014bdb954fc90633
Provides Management: No
Available:           Unlimited
Suggested:           1
Service Level:       Full-Service
Service Type:        Drive-Through
Subscription Type:   Standard
Ends:                02/29/2016
System Type:         Virtual

[root@jsefler-os6 ~]# 
[root@jsefler-os6 ~]# subscription-manager attach --pool=8a9087e34bdb9471014bdb954fc90633
Successfully attached a subscription for: Awesome OS Server Basic (data center)
[root@jsefler-os6 ~]# subscription-manager attach --pool 8a9087e34bdb9471014bdb954f5f05e0
Successfully attached a subscription for: Awesome OS Server Basic (data center)
Traceback (most recent call last):
  File "/usr/share/rhsm/subscription_manager/dbus_interface.py", line 59, in emit_status
    self.validity_iface.emit_status()
  File "/usr/lib/python2.6/site-packages/dbus/proxies.py", line 68, in __call__
    return self._proxy_method(*args, **keywords)
  File "/usr/lib/python2.6/site-packages/dbus/proxies.py", line 140, in __call__
    **keywords)
  File "/usr/lib/python2.6/site-packages/dbus/connection.py", line 630, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Python.UnboundLocalError: Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/dbus/service.py", line 702, in _message_cb
    retval = candidate_method(self, *args, **keywords)
  File "/usr/libexec/rhsmd", line 202, in emit_status
    self._dbus_properties = refresh_compliance_status(self._dbus_properties)
  File "/usr/share/rhsm/subscription_manager/managerlib.py", line 920, in refresh_compliance_status
    entitlements[label] = (name, state, message)
UnboundLocalError: local variable 'state' referenced before assignment

[root@jsefler-os6 ~]# subscription-manager status
+-------------------------------------------+
   System Status Details
+-------------------------------------------+
Overall Status: Invalid

Awesome OS Server Basic (data center):
- Only supports 2GB of 4GB of RAM.

UNABLE_TO_GET_NAME:
- Guest has not been reported on any host and is using a temporary unmapped guest subscription.

Awesome OS Server Bits:
- Not supported by a valid subscription.




NOTICE: Both the Traceback and the "UNABLE_TO_GET_NAME" results are unexpected.

Comment 4 John Sefler 2015-03-30 20:33:39 UTC
Although this is a regression, it is not a blocker for rhel6.7 since it happens rarely.  If it does occur, the user should re-try.

Comment 5 Adrian Likins 2015-04-07 20:14:03 UTC
If compliance status includes reasons that do not include a prod id, this
could get triggered. unmapped guest related? It's similar to 
https://bugzilla.redhat.com/show_bug.cgi?id=1201727

Looks like this got broken in:

commit 3d5a9a5dba480d75f52ff7201af01496c871ab58
Author: Adrian Likins <alikins>
Date:   Mon Jan 19 13:16:12 2015 -0500

    1183122: Fix KeyErrors building dbus ent status
    
    If the info returned from a cert_sorter.get_compliance_status
    didn't have keys we expected, we broke.
    
    Attempt to be more lenient about the structure of compliance
    status. Ignore missing keys, empty lists, etc.
    
    Move refresh_compliance_status to managerlib, and add tests
    to test_managerlib.



I'm not going to say it's DBUS.

But it's DBUS.

(more accurately, the cockpit related changes we backed out for 7.1).

Comment 7 Devan Goodwin 2015-04-09 19:33:39 UTC
We believe this will be fixed by reverting the dbus code that triggers events on compliance status changes.

subscription-manager.git: cf23450fc1d519a7d0e90611499047ce2e7c3334
Will appear in subscription-manager-1.15.3-1

Comment 8 John Sefler 2015-04-20 16:24:06 UTC
Since I don't have an exact reproducer, I'm going to let this one bake for a little while.  If it does not re-surface through automated test runs, then I'll move it to VERIFIED.

Comment 9 Shwetha Kallesh 2015-04-24 08:42:21 UTC
I have reproduced this a few times but of late with following version have not seen the traceback

server type: Red Hat Subscription Management
subscription management server: 0.9.49-1
subscription management rules: 5.15
subscription-manager: 1.14.5-1.el6
python-rhsm: 1.14.2-1.el6

[root@dhcp35-135 ~]# subscription-manager register --force --user admin --org admin
The system with UUID c854f8c0-6695-4450-96e5-55f2f1d596dd has been unregistered
Password: 
The system has been registered with ID: da824863-9f6d-4286-bca3-f73a2e0b4d75 
[root@dhcp35-135 ~]# subscription-manager list --installed

+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
Product Name:   Awesome OS Server Bits
Product ID:     37060
Version:        6.1
Arch:           ALL
Status:         Not Subscribed
Status Details: Not supported by a valid subscription.
Starts:         
Ends:           

[root@dhcp35-135 ~]# subscription-manager facts | grep is_guest
virt.is_guest: True
[root@dhcp35-135 ~]# subscription-manager list --all --avail --matches "*data center*"
+-------------------------------------------+
    Available Subscriptions
+-------------------------------------------+
Subscription Name:   Awesome OS Server Basic (data center)
Provides:            
SKU:                 awesomeos-server-basic-dc
Contract:            4
Pool ID:             8ac681e44cc1fa3e014cc1fb9f261fc9
Provides Management: No
Available:           5
Suggested:           1
Service Level:       None
Service Type:        Self-Support
Subscription Type:   Standard
Ends:                04/15/2016
System Type:         Physical

Subscription Name:   Awesome OS Server Basic (data center)
Provides:            
SKU:                 awesomeos-server-basic-dc
Contract:            5
Pool ID:             8ac681e44cc1fa3e014cc1fb9c081f15
Provides Management: No
Available:           10
Suggested:           1
Service Level:       None
Service Type:        Self-Support
Subscription Type:   Standard
Ends:                04/15/2016
System Type:         Physical

[root@dhcp35-135 ~]# subscription-manager attach --pool 8ac681e44cc1fa3e014cc1fb9c081f15
Successfully attached a subscription for: Awesome OS Server Basic (data center)
[root@dhcp35-135 ~]# subscription-manager attach --pool 8ac681e44cc1fa3e014cc1fb9f261fc9
Successfully attached a subscription for: Awesome OS Server Basic (data center)
[root@dhcp35-135 ~]# subscription-manager status
+-------------------------------------------+
   System Status Details
+-------------------------------------------+
Overall Status: Invalid

Awesome OS Server Basic (data center):
- Only supports 8 of 32 vCPUs.

Awesome OS Server Bits:
- Not supported by a valid subscription.

Comment 10 Shwetha Kallesh 2015-05-05 14:00:29 UTC
We have not observed the trace back both in automated as well manual tests,hence marking verified!!

Comment 11 errata-xmlrpc 2015-07-22 06:53:26 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-1345.html


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