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 1702239 - Syspurpose command shows Python traceback, when locale is not supported
Summary: Syspurpose command shows Python traceback, when locale is not supported
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: subscription-manager
Version: 7.7
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: rc
: ---
Assignee: Jiri Hnidek
QA Contact: Red Hat subscription-manager QE Team
URL:
Whiteboard:
Depends On:
Blocks: 1704281
TreeView+ depends on / blocked
 
Reported: 2019-04-23 09:54 UTC by Jiri Hnidek
Modified: 2020-03-31 19:41 UTC (History)
8 users (show)

Fixed In Version: subscription-manager-1.24.14-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-03-31 19:40:52 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github candlepin subscription-manager pull 2087 0 None closed 1702239: Fix traceback for syspurpose on rhel7; ENT-1286 2020-06-19 13:22:52 UTC
Red Hat Product Errata RHBA-2020:1028 0 None None None 2020-03-31 19:41:26 UTC

Description Jiri Hnidek 2019-04-23 09:54:34 UTC
Description of problem:
When system has set some unsupported locale (e.g. Czech language), then syspurpose command shows Python traceback for every syspurpose command.

Version-Release number of selected component (if applicable):
[root@localhost ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 2.7.0-1
subscription management rules: 5.36
subscription-manager: 1.25.1-1.git.45.9ffd59c.fc29

How reproducible:
100%

Steps to Reproduce:
1. Set locale that is not supported by subscription-manager e.g. Czech language

[root@localhost ~]# export LANG=cs_CZ.utf8

2. Run any syspurpose command:

[root@localhost ~]# syspurpose show

Actual results:

Traceback (most recent call last):
  File "/usr/lib64/python2.7/logging/__init__.py", line 851, in emit
    msg = self.format(record)
  File "/usr/lib64/python2.7/logging/__init__.py", line 724, in format
    return fmt.format(record)
  File "/usr/lib64/python2.7/logging/__init__.py", line 467, in format
    s = self._fmt % record.__dict__
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 105: ordinal not in range(128)
Logged from file identity.py, line 149
{
  "role": "RHEL Server", 
}

Expected results: Output without traceback

Logged from file identity.py, line 149
{
  "role": "RHEL Server", 

}

Additional info:
This bug is propabaly Python2 specific, because it works as expected, when Python3 is used e.g. on Fedora.

Comment 2 Alex Wood 2019-05-02 20:20:18 UTC
I wasn't able to reproduce this issue.  Let me get a little more information from you.

* I was running my test on Centos7.  What distro were you using?
* Is that the full stack trace?  It looks like it but it seems curious that it doesn't reference any lines from subscription-manager
* Since the stacktrace is referencing the logging library, can you paste the last few lines of log output?  Maybe that would help narrow down the search space.

Comment 3 Jiri Hnidek 2019-05-03 07:36:02 UTC
Hi Al,
I'm sorry. I missed the important information in bug report. I'm able to reproduce the bug, when the system is NOT registered. I'm not able to reproduce the bug, when system is registered.

* I was using CentOS 7 distro too.
* The stack trace is full. It is really strange that there is no reference from subscription-manager.
* There is log (rhsm.log) output:

2019-05-03 07:22:35,495 [DEBUG] syspurpose:4370:MainThread @cli.py:296 - Running the syspurpose utility...
2019-05-03 07:22:35,505 [DEBUG] syspurpose:4370:MainThread @identity.py:138 - Loading consumer info from identity certificates.
2019-05-03 07:22:35,506 [DEBUG] syspurpose:4370:MainThread @connection.py:924 - Connection built: host=svice port=8443 handler=/candlepin auth=identity_cert ca_dir=/etc/rhsm/ca/ insecure=True
2019-05-03 07:22:35,507 [DEBUG] syspurpose:4370:MainThread @files.py:319 - Successfully read local syspurpose contents.
2019-05-03 07:22:35,507 [DEBUG] syspurpose:4370:MainThread @files.py:356 - Successfully read cached syspurpose contents.
2019-05-03 07:22:35,507 [DEBUG] syspurpose:4370:MainThread @files.py:273 - Attempting to sync syspurpose content...
2019-05-03 07:22:35,508 [DEBUG] syspurpose:4370:MainThread @connection.py:591 - Making request: GET /candlepin/status
2019-05-03 07:22:35,520 [DEBUG] syspurpose:4370:MainThread @connection.py:638 - Response: status=200, requestUuid=695b6015-05a1-4e70-8751-cd3eddc6c5d8, request="GET /candlepin/status"
2019-05-03 07:22:35,521 [DEBUG] syspurpose:4370:MainThread @connection.py:977 - Server has the following capabilities: [u'instance_multiplier', u'derived_product', u'vcpu', u'cert_v3', u'remove_by_pool_id', u'syspurpose', u'storage_band', u'cores', u'hypervisors_async', u'org_level_content_access', u'guest_limit', u'ram', u'batch_bind']
2019-05-03 07:22:35,522 [DEBUG] syspurpose:4370:MainThread @files.py:334 - Failed to read remote syspurpose from server: no available connection, or the consumer is not registered.
2019-05-03 07:22:35,526 [DEBUG] syspurpose:4370:MainThread @files.py:552 - Attempting a three-way merge...
2019-05-03 07:22:35,527 [DEBUG] syspurpose:4370:MainThread @files.py:373 - Failed to update remote syspurpose on the server: no available connection, or the consumer is not registered.
2019-05-03 07:22:35,533 [DEBUG] syspurpose:4370:MainThread @files.py:506 - Successfully updated syspurpose values at '/etc/rhsm/syspurpose/syspurpose.json'.
2019-05-03 07:22:35,537 [DEBUG] syspurpose:4370:MainThread @files.py:506 - Successfully updated syspurpose values at '/var/lib/rhsm/cache/syspurpose.json'.
2019-05-03 07:22:35,538 [DEBUG] syspurpose:4370:MainThread @files.py:296 - Successfully synced system purpose.

Comment 5 Jiri Hnidek 2019-05-21 13:39:46 UTC
I forgot to mention the last important detail. The option default_log_level has to be set to "DEBUG" in rhsm.conf.

Comment 7 Shwetha Kallesh 2019-05-30 14:49:56 UTC
Reproducer:

[root@kvm-01-guest10 ~]# subscription-manager version
server type: This system is currently not registered.
subscription management server: 2.3.17-1
subscription management rules: 5.35
subscription-manager: 1.25.1-1.git.78.8ae61ee.el7


[root@kvm-01-guest10 ~]# LANG=cs_CZ.utf8 syspurpose show
Traceback (most recent call last):
  File "/usr/lib64/python2.7/logging/__init__.py", line 851, in emit
    msg = self.format(record)
  File "/usr/lib64/python2.7/logging/__init__.py", line 724, in format
    return fmt.format(record)
  File "/usr/lib64/python2.7/logging/__init__.py", line 467, in format
    s = self._fmt % record.__dict__
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 105: ordinal not in range(128)
Logged from file identity.py, line 149

Comment 8 Chris Snyder 2019-05-30 17:44:29 UTC
This was added by mistake to the errata. The latest build of subscription-manager does not include this bug fix. Moving back to POST (as the fix has been completed upstream but not downstream).

Comment 14 Shwetha Kallesh 2019-09-11 09:53:40 UTC
reproducer:

[root@hpe-dl360egen8-01 ~]# subscription-manager version
server type: This system is currently not registered.
subscription management server: 2.7.5-1
subscription management rules: 5.37
subscription-manager: 1.24.13-1.el7


[root@hpe-dl360egen8-01 ~]# syspurpose set-usage foo
usage set to foo
Unable to send system purpose to subscription management server
[root@hpe-dl360egen8-01 ~]# vi /etc/rhsm/rhsm.conf 
[root@hpe-dl360egen8-01 ~]# export LANG=cs_CZ.utf8
[root@hpe-dl360egen8-01 ~]# syspurpose show
Traceback (most recent call last):
  File "/usr/lib64/python2.7/logging/__init__.py", line 851, in emit
    msg = self.format(record)
  File "/usr/lib64/python2.7/logging/__init__.py", line 724, in format
    return fmt.format(record)
  File "/usr/lib64/python2.7/logging/__init__.py", line 467, in format
    s = self._fmt % record.__dict__
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 105: ordinal not in range(128)
Logged from file identity.py, line 149

{
  "usage": "foo"
}
Unable to send system purpose to subscription management server

Comment 15 Shwetha Kallesh 2019-09-11 09:56:02 UTC
[root@hpe-dl360gen8-01 ~]# subscription-manager version
server type: This system is currently not registered.
subscription management server: 2.7.5-1
subscription management rules: 5.37
subscription-manager: 1.24.17-1.el7


Verification:

[root@hpe-dl360gen8-01 ~]# subscription-manager unregister
Unregistering from: subscription.rhsm.stage.redhat.com:443/subscription
System has been unregistered.


[root@hpe-dl360gen8-01 ~]# cat /etc/rhsm/rhsm.conf | grep log
[logging]
default_log_level = DEBUG


[root@hpe-dl360gen8-01 ~]# export LANG=cs_CZ.utf8
[root@hpe-dl360gen8-01 ~]# syspurpose show
{
  "role": "dsadsa"
}

Comment 17 errata-xmlrpc 2020-03-31 19:40:52 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://access.redhat.com/errata/RHBA-2020:1028


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