Bug 845198 - Locale cannot be switched
Locale cannot be switched
Status: CLOSED ERRATA
Product: Red Hat Satellite 6
Classification: Red Hat
Component: katello-agent (Show other bugs)
6.0.0
Unspecified Unspecified
unspecified Severity medium (vote)
: Unspecified
: --
Assigned To: Tomas Strachota
Og Maciel
: Triaged
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-08-02 04:27 EDT by Lukas Zapletal
Modified: 2014-01-27 08:33 EST (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
System Engine used the system's default locale regardless of what had been chosen as locale. This patch enables setting the locale via the "LC_ALL" option on the command line. This sends the correct locale to the server. Local messages from the client are now sent correctly.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-12-04 14:51:10 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Lukas Zapletal 2012-08-02 04:27:08 EDT
Description of problem:

When you try to explicitely switch over to a different locale:

LC_ALL=fr katello environment list

katello always use systems default one.

All versions of CFSE, Katello and SAM.

To fix this issue, make sure:

1) it sends out correct locale to the server in HTTP header
2) it switches client to correct locale so local messages are correct
Comment 1 Miroslav Suchý 2012-08-24 16:08:48 EDT
https://github.com/Katello/katello/pull/471
Comment 2 Miroslav Suchý 2012-08-27 04:00:05 EDT
We still have in our code:
  from gettext import gettext as _
while I believe that correct is to convert all string to unicode as soon as possible and therefore use:
  from gettext import ugettext as _
Comment 3 Miroslav Suchý 2012-08-28 04:51:09 EDT
Today nightly (with pull 471 in place results in:
[root@ibm-x3655-03 ~]# export LANG=de_DE
[root@ibm-x3655-03 ~]# kk --help
error: 'ascii' codec can't decode byte 0xc3 in position 93: ordinal not in range(128) (more in the log file /var/log/katello/client.log)
Comment 4 Miroslav Suchý 2012-08-28 05:44:03 EDT
Proposed fix:
https://github.com/Katello/katello/pull/529
Comment 7 Og Maciel 2012-09-14 18:10:38 EDT
# LANG=it katello --help
Usage:  katello <options> <command>
Supported Commands:
	activation_key azioni specifiche alla chiave di attivazione nel server di katello
	admin          various administrative actions
	changeset      Azioni specifiche al changeset nel server di katello
	client         azioni specifiche del client nel server di katello
	distribution   azioni specifiche per il repo nel server di katello
	environment    azioni specifiche all'ambiente nel server di katello
	errata         azioni specifiche dell'errata nel server di katello
	filter         azioni specifiche del filtro nel server di katello
	gpg_key        azioni specifiche della chiave GPG nel server di katello
	org            azioni specifiche dell'organizzazione nel server di katello
	package        azioni specifiche al pacchetto nel server di katello
	package_group  azioni specifiche al gruppo di pacchetti nel server di katello
	permission     azioni specifiche al permesso nel server di katello
	ping           acquisisci lo stato del server di katello
	product        azioni specifiche del prodotto nel server di katello
	provider       azioni specifiche del provider nel server di katello
	repo           azioni specifiche per il repo nel server di katello
	shell          esegui cli come una shell
	sync_plan      azioni specifiche del programma di sincronizzazione nel server di katello
	system         azioni specifiche del sistema nel server di katello
	system_group   system group specific actions in the katello server
	template       azioni specifiche del template nel server di katello
	user           azioni specifiche dell'utente nel server di katello
	user_role      azioni specifiche del ruolo utente nel server di katello
	version        get the version of the katello server

Options:
  -h, --help            show this help message and exit
  -v, --version         prints version information
  -d, --debug           send debug information into logs

  Credenziali account utente di katello:
    -u USERNAME, --username=USERNAME
                        nome utente account
    -p PASSWORD, --password=PASSWORD
                        password account

  Informazioni server di katello:
    --host=HOST         Hostname del server di katello (default:
                        localhost.localdomain)
# LANG=ko katello --help
Usage:  katello <options> <command>
Supported Commands:
	activation_key katello 서버에서 활성키의 특정 동작 
	admin          various administrative actions
	changeset      katello 서버에서 변경 집합의 특정 동작  
	client         katello 서버에서 클라이언트의 특정 동작 
	distribution   katello 서버에서 리포지터리의 특정 동작 
	environment    katello 서버 환경의 특정 동작  
	errata         katello 서버에서 에라타의 특정 동작 
	filter         katello 서버에서 필터의 특정 동작 
	gpg_key        katello 서버에서 GPG 키의 특정 동작 
	org            katello 서버에서 조직의 특정 동작 
	package        katello 서버에서 패키지의 특정 동작 
	package_group  katello 서버에서 패키지 그룹의 특정 동작 
	permission     katello 서버에서 권한의 특정 동작 
	ping            katello 서버의 상태 획득 
	product        katello 서버에서 제품의 특정 동작 
	provider       katello 서버에서 공급자의 특정 동작 
	repo           katello 서버에서 리포지터리의 특정 동작 
	shell          쉘로 cli를 실행 
	sync_plan      katello 서버에 있는 동기화 계획의 특정 동작 
	system         katello 서버에서 시스템의 특정 동작 
	system_group   system group specific actions in the katello server
	template       katello 서버에서 템플릿의 특정 동작 
	user           katello 서버에서 실행되는 사용자의 특정 동작 
	user_role      katello 서버에서 사용자 역할의 특정 동작 
	version        get the version of the katello server

Options:
  -h, --help            show this help message and exit
  -v, --version         prints version information
  -d, --debug           send debug information into logs

  Katello 사용자 계정 인증서 :
    -u USERNAME, --username=USERNAME
                        계정 사용자 이름
    -p PASSWORD, --password=PASSWORD
                        계정 암호

  Katello 서버 정보 :
    --host=HOST         katello 서버 호스트 이름 (디폴트: localhost.localdomain)
Comment 8 Og Maciel 2012-09-14 18:10:56 EDT
Verified using:

* candlepin-0.7.8-1.el6cf.noarch
* candlepin-selinux-0.7.8-1.el6cf.noarch
* candlepin-tomcat6-0.7.8-1.el6cf.noarch
* katello-1.1.12-7.el6cf.noarch
* katello-all-1.1.12-7.el6cf.noarch
* katello-candlepin-cert-key-pair-1.0-1.noarch
* katello-certs-tools-1.1.8-1.el6cf.noarch
* katello-cli-1.1.8-4.el6cf.noarch
* katello-cli-common-1.1.8-4.el6cf.noarch
* katello-common-1.1.12-7.el6cf.noarch
* katello-configure-1.1.9-3.el6cf.noarch
* katello-glue-candlepin-1.1.12-7.el6cf.noarch
* katello-glue-pulp-1.1.12-7.el6cf.noarch
* katello-qpid-broker-key-pair-1.0-1.noarch
* katello-qpid-client-key-pair-1.0-1.noarch
* katello-selinux-1.1.1-1.el6cf.noarch
* pulp-1.1.12-1.el6cf.noarch
* pulp-common-1.1.12-1.el6cf.noarch
* pulp-selinux-server-1.1.12-1.el6cf.noarch
Comment 9 Ivan Necas 2012-10-05 05:55:25 EDT
However, this fails for some values of LANG, e.g.:

LANG=ja_JP.UTF8 katello -u admin -p admin ping

error: category LC_ALL is not supported (more in the log file /var/log/katello/c
lient.log)

  File "/usr/lib/python2.6/site-packages/katello/client/cli/base.py", line 147, 
in setup_server
    self._server = server.KatelloServer(host, int(port), scheme, path, self.__se
rver_locale())
  File "/usr/lib/python2.6/site-packages/katello/client/cli/base.py", line 157, 
in __server_locale
    loc = locale.getlocale(locale.LC_ALL)[0] or locale.getdefaultlocale()[0]
  File "/usr/lib64/python2.6/locale.py", line 496, in getlocale
    raise TypeError, 'category LC_ALL is not supported'
TypeError: category LC_ALL is not supported



The system is RHEL 6.3
Comment 10 Ivan Necas 2012-10-05 06:27:12 EDT
Note:

this happens only when this environment variable is set:

LC_CTYPE=en_US.UTF-8
Comment 13 Og Maciel 2012-10-08 17:52:42 EDT
# LANG=ja_JP.UTF8 katello -u admin -p admin ping
--------------------------------------------------------------------------------------------------------------
                                               Katello ステータス

 状態     Service          結果     Duration   Message  
--------------------------------------------------------------------------------------------------------------
 ok                                                 
        candlepin        ok     32ms                
        candlepin_auth   ok     31ms                
        elasticsearch    ok     75ms                
        katello_jobs     ok     59ms                
        pulp             ok     297ms               
        pulp_auth        ok     59ms
Comment 14 Og Maciel 2012-10-08 17:53:25 EDT
[root@qetello04 ~]# LANG=pt_BR katello -u admin -p admin ping
--------------------------------------------------------------------------------------------------------------
                                             Status do Katello

 Status   Service          Resultado   Duration   Message  
--------------------------------------------------------------------------------------------------------------
 ok                                                        
          candlepin        ok          30ms                
          candlepin_auth   ok          40ms                
          elasticsearch    ok          25ms                
          katello_jobs     ok          34ms                
          pulp             ok          61ms                
          pulp_auth        ok          78ms                
[root@qetello04 ~]# LANG=fr katello -u admin -p admin ping
--------------------------------------------------------------------------------------------------------------
                                                État Katello

 État   Service          Résultat   Duration   Message  
--------------------------------------------------------------------------------------------------------------
 ok                                                     
        candlepin        ok         26ms                
        candlepin_auth   ok         203ms               
        elasticsearch    ok         16ms                
        katello_jobs     ok         40ms                
        pulp             ok         52ms                
        pulp_auth        ok         57ms
Comment 15 Og Maciel 2012-10-08 17:53:55 EDT
Verified:

* candlepin-0.7.8.1-1.el6cf.noarch
* candlepin-selinux-0.7.8.1-1.el6cf.noarch
* candlepin-tomcat6-0.7.8.1-1.el6cf.noarch
* katello-1.1.12-14.el6cf.noarch
* katello-all-1.1.12-14.el6cf.noarch
* katello-candlepin-cert-key-pair-1.0-1.noarch
* katello-certs-tools-1.1.8-1.el6cf.noarch
* katello-cli-1.1.8-7.el6cf.noarch
* katello-cli-common-1.1.8-7.el6cf.noarch
* katello-common-1.1.12-14.el6cf.noarch
* katello-configure-1.1.9-7.el6cf.noarch
* katello-glue-candlepin-1.1.12-14.el6cf.noarch
* katello-glue-pulp-1.1.12-14.el6cf.noarch
* katello-qpid-broker-key-pair-1.0-1.noarch
* katello-qpid-client-key-pair-1.0-1.noarch
* katello-selinux-1.1.1-1.el6cf.noarch
* pulp-1.1.12-1.el6cf.noarch
* pulp-common-1.1.12-1.el6cf.noarch
* pulp-selinux-server-1.1.12-1.el6cf.noarch
Comment 17 errata-xmlrpc 2012-12-04 14:51:10 EST
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.

http://rhn.redhat.com/errata/RHSA-2012-1543.html

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