Bug 1445387 - setting LC_ALL=C locale breaks subscription-manager CLI
Summary: setting LC_ALL=C locale breaks subscription-manager CLI
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: subscription-manager
Version: 7.4
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: rc
: ---
Assignee: Kevin Howell
QA Contact: John Sefler
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-04-25 14:47 UTC by Dominik Perpeet
Modified: 2017-08-01 19:23 UTC (History)
5 users (show)

Fixed In Version: subscription-manager-1.19.10-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-01 19:23:41 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Github candlepin subscription-manager pull 1605 None closed 1445387: Set locale fact to Unknown if value cannot be determined 2020-07-21 02:54:32 UTC
Red Hat Bugzilla 1425922 None CLOSED [RFE] Get system locale setting into cp_consumer_facts 2018-12-13 17:10:27 UTC
Red Hat Bugzilla 1444453 None None None 2018-12-13 17:10:27 UTC
Red Hat Product Errata RHBA-2017:2083 normal SHIPPED_LIVE python-rhsm and subscription-manager bug fix and enhancement update 2017-08-01 18:14:19 UTC

Internal Links: 1425922 1444453

Description Dominik Perpeet 2017-04-25 14:47:47 UTC
Description of problem:
Calling subscription-manager with LC_ALL=C leads to an error, the system can't be registered. Found during Cockpit integration testing.

Version-Release number of selected component (if applicable):
subscription-manager-1.19.9-1.el7.x86_64

How reproducible:
Always


Steps to Reproduce:
1. LC_ALL=C subscription-manager register --serverurl https://10.111.122.93:8443/candlepin

Actual results:
sequence item 0: expected string, NoneType found


Expected results:
The system has been registered

Additional info:
2017-04-25 10:41:59,017 [INFO] subscription-manager:2448:MainThread @managercli.py:507 - X-Correlation-ID: 6562355580434db2a4e8e2d9cd2819d1
2017-04-25 10:41:59,018 [INFO] subscription-manager:2448:MainThread @managercli.py:396 - Client Versions: {'python-rhsm': '1.19.5-1.el7', 'subscription-manager': '1.19.9-1.el7'}
2017-04-25 10:41:59,018 [INFO] subscription-manager:2448:MainThread @connection.py:780 - Connection built: host=10.111.122.93 port=8443 handler=/candlepin auth=identity_cert ca_dir=/etc/rhsm/ca/ insecure=True
2017-04-25 10:41:59,018 [INFO] subscription-manager:2448:MainThread @connection.py:780 - Connection built: host=10.111.122.93 port=8443 handler=/candlepin auth=none
2017-04-25 10:41:59,049 [INFO] subscription-manager:2448:MainThread @connection.py:520 - Response: status=200, requestUuid=9a6f7689-b5be-42c2-b972-ac34f2b3fd96, request="GET /candlepin/status/"
2017-04-25 10:41:59,049 [INFO] subscription-manager:2448:MainThread @managercli.py:396 - Client Versions: {'python-rhsm': '1.19.5-1.el7', 'subscription-manager': '1.19.9-1.el7'}
2017-04-25 10:41:59,063 [INFO] subscription-manager:2448:MainThread @managercli.py:371 - Consumer Identity name=None uuid=None
2017-04-25 10:41:59,065 [INFO] subscription-manager:2448:MainThread @managercli.py:371 - Consumer Identity name=None uuid=None
2017-04-25 10:42:03,462 [INFO] subscription-manager:2448:MainThread @connection.py:780 - Connection built: host=10.111.122.93 port=8443 handler=/candlepin auth=basic username=doc
2017-04-25 10:42:03,485 [WARNING] subscription-manager:2448:MainThread @dmiinfo.py:86 - Error reading system DMI information: coercing to Unicode: need string or buffer, NoneType found
2017-04-25 10:42:03,517 [ERROR] subscription-manager:2448:MainThread @managercli.py:179 - Error during registration: sequence item 0: expected string, NoneType found
2017-04-25 10:42:03,517 [ERROR] subscription-manager:2448:MainThread @managercli.py:180 - sequence item 0: expected string, NoneType found
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/subscription_manager/managercli.py", line 1139, in _do_command
    facts_dict = facts.get_facts()
  File "/usr/lib/python2.7/site-packages/subscription_manager/facts.py", line 79, in get_facts
    facts = collector.get_all()
  File "/usr/lib/python2.7/site-packages/rhsmlib/facts/all.py", line 31, in get_all
    results.update(fact_collector.get_all())
  File "/usr/lib/python2.7/site-packages/rhsmlib/facts/host_collector.py", line 90, in get_all
    locale_info['system.default_locale'] = ".".join(locale.getdefaultlocale())
TypeError: sequence item 0: expected string, NoneType found

Comment 2 John Sefler 2017-04-25 14:51:05 UTC
This is a Regression from subscription-manager-1.17.15-1.el7.x86_64 in RHEL73.

Comment 5 Dominik Perpeet 2017-04-25 15:38:15 UTC
This also prevents using Cockpit to register a system.

Comment 6 Chris Snyder 2017-04-25 16:43:23 UTC
The fix has been merged upstream, moving to POST awaiting inclusion in a build.

Comment 8 Dominik Perpeet 2017-04-28 10:50:50 UTC
I can confirm this works in Cockpit's CI using the latest nightly compose with the version of subscription-manager specified in this bug (subscription-manager-1.19.10-1).

Thanks for the quick fix!

Comment 9 John Sefler 2017-04-28 14:02:30 UTC
Verifying Version...
[root@jsefler-rhel7 ~]# LC_ALL=C subscription-manager version
server type: This system is currently not registered.
subscription management server: 2.1.0-1
subscription management rules: 5.23
subscription-manager: 1.19.10-1.el7
python-rhsm: 1.19.5-1.el7

[root@jsefler-rhel7 ~]# LC_ALL=C subscription-manager register
Registering to: jsefler-candlepin.usersys.redhat.com:8443/candlepin
Username: testuser1
Password: 
Organization: admin
The system has been registered with ID: 19c90b73-92c9-4d1f-a9a4-1ac96e2f4f48 
[root@jsefler-rhel7 ~]# 
[root@jsefler-rhel7 ~]# LC_ALL=C subscription-manager unregister
System has been unregistered.

[root@jsefler-rhel7 ~]# LC_ALL=fr_FR.utf-8 subscription-manager register
Enregistrement sur : jsefler-candlepin.usersys.redhat.com:8443/candlepin
Nom d'utilisateur : testuser1
Mot de passe : 
Organisation : admin
Le système a été enregistré avec l'ID : f9ce43c5-9e58-4d00-b288-11a44f10ae4d 
[root@jsefler-rhel7 ~]# LC_ALL=fr_FR.utf-8 subscription-manager unregister
Le système a été désenregistré.
[root@jsefler-rhel7 ~]# 

VERIFIED: no more traceback when using LC_ALL=C without breaking LC_ALL=fr_FR.utf-8 (a translated LANG).

Comment 10 errata-xmlrpc 2017-08-01 19:23:41 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-2017:2083


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