Bug 1449839

Summary: 'utf8' codec can't decode byte 0xa0 in position 15: invalid start byte
Product: Red Hat Enterprise Linux 7 Reporter: John Sefler <jsefler>
Component: python-rhsmAssignee: Kevin Howell <khowell>
Status: CLOSED DUPLICATE QA Contact: John Sefler <jsefler>
Severity: high Docs Contact:
Priority: urgent    
Version: 7.4CC: khowell, redakkan, skallesh
Target Milestone: rcKeywords: Regression, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-05-15 19:39:08 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 John Sefler 2017-05-10 21:02:10 UTC
Description of problem:


Version-Release number of selected component (if applicable):
[root@jsefler-rhel7 ~]# rpm -q python-rhsm subscription-manager
python-rhsm-1.19.6-1.el7.x86_64
subscription-manager-1.19.12-1.el7.x86_64


How reproducible:


Steps to Reproduce:
[root@jsefler-rhel7 ~]# LANG=fr_FR subscription-manager register --serverurl=subscription.rhsm.stage.redhat.com:443/subscription
Enregistrement sur : subscription.rhsm.stage.redhat.com:443/subscription
Nom d'utilisateur : qa
Mot de passe : 
'utf8' codec can't decode byte 0xa0 in position 15: invalid start byte

[root@jsefler-rhel7 ~]# tail -f /var/log/rhsm/rhsm.log
2017-05-10 16:53:09,336 [ERROR] subscription-manager:26756:MainThread @managercli.py:179 - Erreur lors de l'enregistrement : 'utf8' codec can't decode byte 0xa0 in position 15: invalid start byte
2017-05-10 16:53:09,336 [ERROR] subscription-manager:26756:MainThread @managercli.py:180 - 'utf8' codec can't decode byte 0xa0 in position 15: invalid start byte
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/subscription_manager/managercli.py", line 1199, in _do_command
    content_tags=self.installed_mgr.tags)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 878, in registerConsumer
    return self.conn.request_post(url, params)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 617, in request_post
    return self._request("POST", method, params, headers=headers)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 640, in _request
    info=info, headers=headers)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 480, in _request
    body = json.dumps(info, default=json.encode)
  File "/usr/lib64/python2.7/json/__init__.py", line 250, in dumps
    sort_keys=sort_keys, **kw).encode(obj)
  File "/usr/lib64/python2.7/json/encoder.py", line 207, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib64/python2.7/json/encoder.py", line 270, in iterencode
    return _iterencode(o, 0)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xa0 in position 15: invalid start byte



Actual results:
  above

Expected results:
  successful registration in locale fr_FR.ISO8859-1

[root@jsefler-rhel7 ~]# LANG=fr_FR subscription-manager facts | grep locale
system.default_locale: fr_FR.ISO8859-1

Comment 2 John Sefler 2017-05-10 21:03:59 UTC
Additional info:

The behavior in comment 0 is a regression from the RHEL7.3 version of RHSM packages...
[root@jsefler-rhel7 ~]# rpm -q python-rhsm subscription-manager
python-rhsm-1.17.9-1.el7.x86_64
subscription-manager-1.17.15-1.el7.x86_64

[root@jsefler-rhel7 ~]# LANG=fr_FR subscription-manager register --serverurl=subscription.rhsm.stage.redhat.com:443/subscription
Enregistrement sur : subscription.rhsm.stage.redhat.com:443/subscription
Nom d'utilisateur : qa
Mot de passe : 
Le système a été enregistré avec l'ID : feddd2fd-1dce-42f4-873f-920acb6f877d 
[root@jsefler-rhel7 ~]# 

^^ Successful registration in RHEL7.3

Comment 3 John Sefler 2017-05-10 22:03:19 UTC
This also fails for ja_JP

[root@jsefler-rhel7 ~]# LANG=ja_JP subscription-manager register --serverurl=subscription.rhsm.stage.redhat.com:443/subscription
登録中: subscription.rhsm.stage.redhat.com:443/subscription
ユーザー名: qa
パスワード: 
'utf8' codec can't decode byte 0xb2 in position 6: invalid start byte
[root@jsefler-rhel7 ~]#

Comment 4 Kevin Howell 2017-05-11 14:24:25 UTC
Not specific to latin-1:

[root@centos7 ~]# LANG=ja_JP subscription-manager facts | grep locale
system.default_locale: ja_JP.eucJP

Comment 5 Kevin Howell 2017-05-15 19:39:08 UTC
I found that what was happening is that since bug 1450210 was causing the facts to be collected in a wrong locale, when we tried to build JSON, this caused the serialization to fail.

*** This bug has been marked as a duplicate of bug 1450210 ***