Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
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.
Description of problem:
When there is a malformed custom fact or simply an empty custom facts file, a traceback occurs during registration.
This is a regression from RHEL7.3 where a WARNING like the following was written to rhsm.log
[WARNING] @facts.py:125 - Unable to load custom facts file: /etc/rhsm/facts/empty.facts
Version-Release number of selected component (if applicable):
[root@jsefler-rhel7 ~]# rpm -q subscription-manager python-rhsm
subscription-manager-1.19.4-1.el7.x86_64
python-rhsm-1.19.2-1.el7.x86_64
How reproducible:
Steps to Reproduce:
[root@jsefler-rhel7 ~]# touch /etc/rhsm/facts/empty.facts
[root@jsefler-rhel7 ~]# subscription-manager register
Registering to: jsefler-candlepin.usersys.redhat.com:8443/candlepin
Username: testuser1
Password:
com.redhat.RHSM1.Error: Traceback (most recent call last):
File "/usr/lib64/python2.7/site-packages/dbus/service.py", line 707, in _message_cb
retval = candidate_method(self, *args, **keywords)
File "<string>", line 2, in GetFacts
File "/usr/lib/python2.7/site-packages/rhsmlib/dbus/util.py", line 32, in dbus_handle_exceptions
ret = func(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/rhsmlib/dbus/facts/base.py", line 79, in GetFacts
results.update(fact_collector.GetFacts())
File "<string>", line 2, in GetFacts
File "/usr/lib/python2.7/site-packages/rhsmlib/dbus/util.py", line 32, in dbus_handle_exceptions
ret = func(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/rhsmlib/dbus/facts/base.py", line 43, in GetFacts
collection = self.facts_collector.collect()
File "/usr/lib/python2.7/site-packages/rhsmlib/facts/collector.py", line 84, in collect
facts_dict.update(self.get_all())
File "/usr/lib/python2.7/site-packages/rhsmlib/facts/host_collector.py", line 85, in get_all
custom_facts_dict = custom_facts.get_all()
File "/usr/lib/python2.7/site-packages/rhsmlib/facts/custom.py", line 111, in get_all
for custom_facts in facts_dir:
File "/usr/lib/python2.7/site-packages/rhsmlib/facts/custom.py", line 85, in __iter__
yield CustomFacts.from_json(fact_file.read())
File "/usr/lib/python2.7/site-packages/rhsmlib/facts/custom.py", line 37, in from_json
custom_facts.data = data
RHSM1DBusException: com.redhat.RHSM1.Error: UnboundLocalError: local variable 'data' referenced before assignment
Actual results:
above
Expected results:
expected a successful register with the following rhsm.log entry
[WARNING] @facts.py:125 - Unable to load custom facts file: /etc/rhsm/facts/empty.facts
Additional info:
The same traceback is thrown when a custom facts file has malformed json, like this...
[root@jsefler-rhel7 ~]# cat /etc/rhsm/facts/malformed.facts
{"malformed_fact":"value" is "misquoted"}
I have a fix for the exception.
I am currently investigating whether logging in the dbus service works at all. As far as I can tell there is no reason (with my fix) the desired log message should not be written to /etc/rhsm/rhsm.log but yet it is not. Furthermore, I've not seen any log messages coming from the dbus service.
I will continue investigation.
I have employed the same logic as is done in rhsmd, applied to the dbus services.
The PR with the both fixes necessary for this bug has been attached as an external tracker to this bug.
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://access.redhat.com/errata/RHBA-2017:2083
Description of problem: When there is a malformed custom fact or simply an empty custom facts file, a traceback occurs during registration. This is a regression from RHEL7.3 where a WARNING like the following was written to rhsm.log [WARNING] @facts.py:125 - Unable to load custom facts file: /etc/rhsm/facts/empty.facts Version-Release number of selected component (if applicable): [root@jsefler-rhel7 ~]# rpm -q subscription-manager python-rhsm subscription-manager-1.19.4-1.el7.x86_64 python-rhsm-1.19.2-1.el7.x86_64 How reproducible: Steps to Reproduce: [root@jsefler-rhel7 ~]# touch /etc/rhsm/facts/empty.facts [root@jsefler-rhel7 ~]# subscription-manager register Registering to: jsefler-candlepin.usersys.redhat.com:8443/candlepin Username: testuser1 Password: com.redhat.RHSM1.Error: Traceback (most recent call last): File "/usr/lib64/python2.7/site-packages/dbus/service.py", line 707, in _message_cb retval = candidate_method(self, *args, **keywords) File "<string>", line 2, in GetFacts File "/usr/lib/python2.7/site-packages/rhsmlib/dbus/util.py", line 32, in dbus_handle_exceptions ret = func(*args, **kwargs) File "/usr/lib/python2.7/site-packages/rhsmlib/dbus/facts/base.py", line 79, in GetFacts results.update(fact_collector.GetFacts()) File "<string>", line 2, in GetFacts File "/usr/lib/python2.7/site-packages/rhsmlib/dbus/util.py", line 32, in dbus_handle_exceptions ret = func(*args, **kwargs) File "/usr/lib/python2.7/site-packages/rhsmlib/dbus/facts/base.py", line 43, in GetFacts collection = self.facts_collector.collect() File "/usr/lib/python2.7/site-packages/rhsmlib/facts/collector.py", line 84, in collect facts_dict.update(self.get_all()) File "/usr/lib/python2.7/site-packages/rhsmlib/facts/host_collector.py", line 85, in get_all custom_facts_dict = custom_facts.get_all() File "/usr/lib/python2.7/site-packages/rhsmlib/facts/custom.py", line 111, in get_all for custom_facts in facts_dir: File "/usr/lib/python2.7/site-packages/rhsmlib/facts/custom.py", line 85, in __iter__ yield CustomFacts.from_json(fact_file.read()) File "/usr/lib/python2.7/site-packages/rhsmlib/facts/custom.py", line 37, in from_json custom_facts.data = data RHSM1DBusException: com.redhat.RHSM1.Error: UnboundLocalError: local variable 'data' referenced before assignment Actual results: above Expected results: expected a successful register with the following rhsm.log entry [WARNING] @facts.py:125 - Unable to load custom facts file: /etc/rhsm/facts/empty.facts Additional info: The same traceback is thrown when a custom facts file has malformed json, like this... [root@jsefler-rhel7 ~]# cat /etc/rhsm/facts/malformed.facts {"malformed_fact":"value" is "misquoted"}