Bug 1371871

Summary: UnicodeDecodeError when running rhnreg_ks with a different locale than en_US
Product: Red Hat Enterprise Linux 7 Reporter: Radovan Drazny <rdrazny>
Component: rhn-client-toolsAssignee: Gennadii Altukhov <galtukho>
Status: CLOSED ERRATA QA Contact: Pavel Studeník <pstudeni>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.3CC: galtukho, jhutar, pstudeni, tlestach
Target Milestone: rc   
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-08-01 22:19:00 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:

Description Radovan Drazny 2016-08-31 10:13:20 UTC
Description of problem:
When rhnreg_ks is run with a non-ascii locale there is a Python traceback dumped to the console with a message about UnicodeDecodeError. 

Version-Release number of selected component (if applicable): 
rhn-client-tools-2.0.2-8.el7

How reproducible:
always

Steps to Reproduce:
Run the following command:
LANG=de_DE.utf8 rhnreg_ks --serverUrl=https://xmlrpc.rhn.redhat.com/XMLRPC --sslCACert=/usr/share/rhn/RHNS-CA-CERT --username=<rhn-username> --password=<rhnpassword> --force

Actual results:

# LANG=de_DE.utf8 rhnreg_ks --serverUrl=https://xmlrpc.rhn.redhat.com/XMLRPC --sslCACert=/usr/share/rhn/RHNS-CA-CERT --username=<rhn-username> --password=<rhnpassword> --force
Ein Fehler ist aufgetreten:

Red Hat Network Classic wird nicht unterstützt.
Registrierung bei der Red Hat Subskriptionsverwaltung durch:

    subscription-manager register --auto-attach
Weitere Informationen unter access.redhat.com/knowledge

Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/share/rhn/up2date_client/rhncli.py", line 230, in exceptionHandler
    log.log_exception(type, value, tb)
  File "/usr/share/rhn/up2date_client/up2dateLog.py", line 54, in log_exception
    self.write_log("".join(output))
  File "/usr/share/rhn/up2date_client/up2dateLog.py", line 60, in write_log
    msg = u"%s %s\n" % (self.log_info, s)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1592: ordinal not in range(128)

Original exception was:
Traceback (most recent call last):
  File "/usr/sbin/rhnreg_ks", line 218, in <module>
    cli.run()
  File "/usr/share/rhn/up2date_client/rhncli.py", line 96, in run
    sys.exit(self.main() or 0)
  File "/usr/sbin/rhnreg_ks", line 138, in main
    self.options.password, profilename, other = other)
  File "/usr/share/rhn/up2date_client/rhnreg.py", line 352, in registerSystem
    ret = s.registration.new_system(auth_dict)
  File "/usr/share/rhn/up2date_client/rhnserver.py", line 63, in __call__
    return rpcServer.doCall(method, *args, **kwargs)
  File "/usr/share/rhn/up2date_client/rpcServer.py", line 204, in doCall
    ret = method(*args, **kwargs)
  File "/usr/lib64/python2.7/xmlrpclib.py", line 1233, in __call__
    return self.__send(self.__name, args)
  File "/usr/share/rhn/up2date_client/rpcServer.py", line 38, in _request1
    ret = self._request(methodname, params)
  File "/usr/lib/python2.7/site-packages/rhn/rpclib.py", line 384, in _request
    self._handler, request, verbose=self._verbose)
  File "/usr/lib/python2.7/site-packages/rhn/transports.py", line 188, in request
    return self._process_response(fd, connection)
  File "/usr/lib/python2.7/site-packages/rhn/transports.py", line 216, in _process_response
    return self.parse_response(fd)
  File "/usr/lib/python2.7/site-packages/rhn/transports.py", line 240, in parse_response
    return u.close()
  File "/usr/lib64/python2.7/xmlrpclib.py", line 794, in close
    raise Fault(**self._stack[0])
up2date_client.up2dateErrors.RegistrationDeniedError:
Red Hat Network Classic wird nicht unterstützt.
Registrierung bei der Red Hat Subskriptionsverwaltung durch:
    subscription-manager register --auto-attach
Weitere Informationen unter access.redhat.com/knowledge

There is no output in the /var/log/up2date.
Same problem with ru_RU.utf8, es_ES.utf8 and fr_FR.utf8, and probably with all non-ascii locales. 

Expected results:

Same as on RHEL 7.2. That means info about using subscription-manager in the console, and the RegistrationDeniedError exception in the /var/lob/up2date.

Additional info:

Comment 2 Gennadii Altukhov 2017-03-06 14:20:48 UTC
spacewalk.git:
5c552d2030aa15d32779a45159f8fc6a9a066a84

Comment 5 Pavel Studeník 2017-05-10 11:12:13 UTC
Verified rhn-setup-2.0.2-11.el7.noarch

>> LANG=de_DE.utf8 rhnreg_ks --serverUrl=https://xmlrpc.rhn.redhat.com/XMLRPC ..
Ein Fehler ist aufgetreten:

Red Hat Network Classic wird nicht unterstützt.
Registrierung bei der Red Hat Subskriptionsverwaltung durch:

    subscription-manager register --auto-attach
Weitere Informationen unter access.redhat.com/knowledge
    
Siehe /var/log/up2date für weitere Informationen

Comment 6 errata-xmlrpc 2017-08-01 22:19:00 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:2039