Bug 1445387

Summary: setting LC_ALL=C locale breaks subscription-manager CLI
Product: Red Hat Enterprise Linux 7 Reporter: Dominik Perpeet <dperpeet>
Component: subscription-managerAssignee: Kevin Howell <khowell>
Status: CLOSED ERRATA QA Contact: John Sefler <jsefler>
Severity: high Docs Contact:
Priority: high    
Version: 7.4CC: csnyder, khowell, redakkan, skallesh, stoner
Target Milestone: rcKeywords: Regression, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: subscription-manager-1.19.10-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 19:23:41 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 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