Bug 1329397
| Summary: | Rhsmcertd healinglib variable 'valid_tomorrow' referenced before assignment | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Chris Snyder <csnyder> |
| Component: | subscription-manager | Assignee: | John Sefler <jsefler> |
| Status: | CLOSED ERRATA | QA Contact: | Jan Stavel <jstavel> |
| Severity: | low | Docs Contact: | |
| Priority: | medium | ||
| Version: | 7.3 | CC: | csnyder, jsefler, jstavel, redakkan, vrjain |
| Target Milestone: | pre-dev-freeze | Keywords: | Triaged |
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | subscription-manager-1.17.6-1 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2016-11-03 20:28:25 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
Chris Snyder
2016-04-21 19:55:00 UTC
Proposed fix from Belonesox: https://github.com/candlepin/subscription-manager/pull/1410 I see in https://github.com/candlepin/subscription-manager/issues/1409 that a "UnboundLocalError: local variable 'valid_tomorrow' referenced before assignment" traceback is being thrown when calling subscription-manager repos --list-enabled. I was not able to reproduce this issue with the limited info. Please provide the specific use case that throws the exception and the subscription-manager version that is failing. I see that from the code fix in comment 2 that it is a simple matter of initialization, but I don't know the exact user scenario to execute and hit the traceback. I have not been able to recreate it. In theory it should arise whenever the certs a system has are valid today but not tomorrow. I've tried entitling a system then moving the date to 1 year in the future on both the server and client (as well as one year - one day in the future) and neither seem to be triggering this issue. That being said it seems a like a clear issue in our code base and has a straight forward fix (define the variable valid_tomorrow with the default of 'false' before we ever use it). If we can find a way to recreate this that wouldn't hurt but I think the fix should be accepted either way. Fix merged to upstream master as of the below commit hash: f99452ebee1ff6b5f559b36b298dec5c8d39f94e Reproducing the error (with rhel72 packages)...
[root@jsefler-rhel7 ~]# rpm -q subscription-manager python-rhsm
subscription-manager-1.15.9-15.el7.x86_64
python-rhsm-1.15.4-5.el7.x86_64
[root@jsefler-rhel7 ~]# subscription-manager register --serverurl=subscription.rhsm.stage.redhat.com --autosubscribe
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Username: stage_auto_testuser1
Password:
The system has been registered with ID: 38e92065-0444-4301-9554-1d3e51f29cd0
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status: Subscribed
[root@jsefler-rhel7 ~]# subscription-manager list --consumed
+-------------------------------------------+
Consumed Subscriptions
+-------------------------------------------+
Subscription Name: Red Hat Enterprise Linux Academic Site Subscription (Server, Desktop, Workstation, POWER, HPC), Premium with Smart Management per FTE
Provides: Oracle Java (for RHEL Server)
Red Hat Enterprise Linux Workstation
Red Hat Enterprise Linux Desktop
Oracle Java (for RHEL Client)
Red Hat Software Collections (for RHEL Client)
dotNET on RHEL Beta (for RHEL Server)
Red Hat Beta
Red Hat Developer Toolset (for RHEL Server)
Red Hat Enterprise Linux Atomic Host Beta
Red Hat Software Collections Beta (for RHEL Client)
Red Hat Container Images Beta
Red Hat Enterprise Linux for Power, little endian
Red Hat Developer Toolset (for RHEL Workstation)
Red Hat Enterprise Linux for SAP
Oracle Java (for RHEL Workstation)
Red Hat Enterprise Linux Atomic Host
Red Hat Enterprise Linux Server
Red Hat Enterprise Linux for Power, big endian
Red Hat Software Collections (for RHEL Server)
dotNET on RHEL (for RHEL Server)
Red Hat Software Collections (for RHEL Workstation)
Red Hat Software Collections Beta (for RHEL Server)
Red Hat Container Images
Red Hat Enterprise Linux for Scientific Computing
Red Hat Software Collections Beta (for RHEL Workstation)
Oracle Java (for RHEL Compute Node)
SKU: RH2501844
Contract:
Account:
Serial: 6097760313817697503
Pool ID: 8a99f986553a7fbb01553c0394232626
Provides Management: Yes
Active: True
Quantity Used: 1
Service Level: Premium
Service Type: L1-L3
Status Details: Subscription is current
Subscription Type: Standard
Starts: 05/28/2016
Ends: 05/27/2017
System Type: Virtual
[root@jsefler-rhel7 ~]#
NOW I WILL ADVANCE MY LOCAL TIME TO THE DATE THE SUBSCRIPTION ENDS
[root@jsefler-rhel7 ~]# date
Wed Jun 22 11:09:06 EDT 2016
[root@jsefler-rhel7 ~]# date -s +339day
Sat May 27 11:15:43 EDT 2017
NOW I WILL RUN THE AUTOHEAL DEAMON AND TAIL THE rhsm.log FOR THE ERROR
[root@jsefler-rhel7 ~]# /usr/libexec/rhsmcertd-worker --autoheal
Updating entitlement certificates & repositories
Installed Products
status: 0
updates: []
exceptions:
Total updates: 0
Found (local) serial# [6097760313817697503L]
Expected (UEP) serial# [6097760313817697503]
Added (new)
<NONE>
Deleted (rogue):
<NONE>
Total updates: 0
Found (local) serial# [6097760313817697503L]
Expected (UEP) serial# [6097760313817697503]
Added (new)
<NONE>
Deleted (rogue):
<NONE>
[root@jsefler-rhel7 ~]#
[root@jsefler-rhel7 ~]# tail -f /var/log/rhsm/rhsm.log
2017-05-27 11:17:53,559 [WARNING] rhsmcertd-worker:25298 @connection.py:559 - Clock skew detected, please check your system time
2017-05-27 11:17:53,560 [INFO] rhsmcertd-worker:25298 @entcertlib.py:131 - certs updated:
Total updates: 0
Found (local) serial# [6097760313817697503L]
Expected (UEP) serial# [6097760313817697503]
Added (new)
<NONE>
Deleted (rogue):
<NONE>
2017-05-27 11:17:53,561 [ERROR] rhsmcertd-worker:25298 @healinglib.py:133 - Error attempting to auto-heal:
2017-05-27 11:17:53,561 [ERROR] rhsmcertd-worker:25298 @healinglib.py:134 - local variable 'valid_tomorrow' referenced before assignment
Traceback (most recent call last):
File "/usr/share/rhsm/subscription_manager/healinglib.py", line 128, in perform
if valid_tomorrow:
UnboundLocalError: local variable 'valid_tomorrow' referenced before assignment
2017-05-27 11:17:53,562 [DEBUG] rhsmcertd-worker:25298 @base_action_client.py:85 - running lib: <subscription_manager.entcertlib.EntCertActionInvoker object at 0x13a0550>
2017-05-27 11:17:53,587 [DEBUG] rhsmcertd-worker:25298 @connection.py:475 - Loaded CA certificates from /etc/rhsm/ca/: jsefler-candlepin.pem, jsefler-os-candlepin.pem, jsefler-candlepin7.pem, jsefler-candlepin6.pem, timeout_listener.pem, redhat-uep.pem, redhat-entitlement-authority.pem
2017-05-27 11:17:53,587 [DEBUG] rhsmcertd-worker:25298 @connection.py:523 - Making request: GET /subscription/consumers/38e92065-0444-4301-9554-1d3e51f29cd0/certificates/serials
2017-05-27 11:17:54,174 [DEBUG] rhsmcertd-worker:25298 @connection.py:555 - Response: status=200, requestUuid=a7d4e2ec-fec6-4d8e-a2af-e9c638d51b6c
2017-05-27 11:17:54,175 [WARNING] rhsmcertd-worker:25298 @connection.py:559 - Clock skew detected, please check your system time
2017-05-27 11:17:54,176 [INFO] rhsmcertd-worker:25298 @entcertlib.py:131 - certs updated:
Total updates: 0
Found (local) serial# [6097760313817697503L]
Expected (UEP) serial# [6097760313817697503]
Added (new)
<NONE>
Deleted (rogue):
<NONE>
BANG! NOTICE THE ERROR IN THE rhsm.log WHILE ATTEMPTING TO AUTO-HEAL: local variable 'valid_tomorrow' referenced before assignment. AND IT IS REPEATABLE WITH EACH CALL TO /usr/libexec/rhsmcertd-worker --autoheal
Verifying Version (after yum update of subscription-manager to fixed version)... [root@jsefler-rhel7 ~]# rpm -q subscription-manager python-rhsm subscription-manager-1.17.7-1.el7.x86_64 python-rhsm-1.17.2-1.el7.x86_64 [root@jsefler-rhel7 ~]# rpm -q subscription-manager --changelog | grep 1329397 - 1329397: github issue #1409 (stas-fomin) CONTINUING SCENARIO ON THE SAME SYSTEM FROM comment 7 AFTER THE PACKAGE UPDATE... [root@jsefler-rhel7 ~]# date Sat May 27 11:27:17 EDT 2017 [root@jsefler-rhel7 ~]# /usr/libexec/rhsmcertd-worker --autoheal Updating entitlement certificates & repositories Installed Products status: 0 updates: [] exceptions: Total updates: 0 Found (local) serial# [6097760313817697503L] Expected (UEP) serial# [6097760313817697503] Added (new) <NONE> Deleted (rogue): <NONE> Total updates: 0 Found (local) serial# [6097760313817697503L] Expected (UEP) serial# [6097760313817697503] Added (new) <NONE> Deleted (rogue): <NONE> 2017-05-27 11:28:26,050 [WARNING] rhsmcertd-worker:26136 @connection.py:593 - Clock skew detected, please check your system time 2017-05-27 11:28:26,050 [INFO] rhsmcertd-worker:26136 @entcertlib.py:131 - certs updated: Total updates: 0 Found (local) serial# [6097760313817697503L] Expected (UEP) serial# [6097760313817697503] Added (new) <NONE> Deleted (rogue): <NONE> 2017-05-27 11:28:26,051 [INFO] rhsmcertd-worker:26136 @healinglib.py:131 - Entitlement auto healing was checked and entitlements are valid today 2017-05-27 15:28:23.558852+00:00 2017-05-27 11:28:26,051 [DEBUG] rhsmcertd-worker:26136 @healinglib.py:139 - Auto-heal check complete. 2017-05-27 11:28:26,052 [DEBUG] rhsmcertd-worker:26136 @base_action_client.py:85 - running lib: <subscription_manager.entcertlib.EntCertActionInvoker object at 0x19f6a50> 2017-05-27 11:28:26,077 [DEBUG] rhsmcertd-worker:26136 @connection.py:509 - Loaded CA certificates from /etc/rhsm/ca/: jsefler-candlepin.pem, jsefler-os-candlepin.pem, jsefler-candlepin7.pem, jsefler-candlepin6.pem, timeout_listener.pem, redhat-uep.pem, redhat-entitlement-authority.pem 2017-05-27 11:28:26,077 [DEBUG] rhsmcertd-worker:26136 @connection.py:557 - Making request: GET /subscription/consumers/38e92065-0444-4301-9554-1d3e51f29cd0/certificates/serials 2017-05-27 11:28:26,779 [DEBUG] rhsmcertd-worker:26136 @connection.py:589 - Response: status=200, requestUuid=3e58afff-0a0b-425a-81d9-b44bd980eb36 2017-05-27 11:28:26,780 [WARNING] rhsmcertd-worker:26136 @connection.py:593 - Clock skew detected, please check your system time 2017-05-27 11:28:26,780 [INFO] rhsmcertd-worker:26136 @entcertlib.py:131 - certs updated: Total updates: 0 Found (local) serial# [6097760313817697503L] Expected (UEP) serial# [6097760313817697503] Added (new) <NONE> Deleted (rogue): <NONE> VERIFIED: No more ERROR "local variable 'valid_tomorrow' referenced before assignment" 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/RHSA-2016-2592.html |