Bug 858960

Summary: [ALL LANG][CFSE CLI] Run 'kateloo --help' with no en_US.UTF-8 locale produced traceback: 'ascii' codec can't encode characters in position.
Product: Red Hat Satellite Reporter: Lijun Li <lijli>
Component: Localization and InternationalizationAssignee: Ivan Necas <inecas>
Status: CLOSED ERRATA QA Contact: Og Maciel <omaciel>
Severity: high Docs Contact:
Priority: high    
Version: 6.0.1CC: asettle, dmacpher, eng-i18n-bugs, inecas, mmccune, omaciel, qe-i18n-bugs
Target Milestone: UnspecifiedKeywords: i18n, Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Running 'katello --help' with UTF-8 locale produced an error: "'ascii' codec can not encode characters in position". This bug fix sets the utf-8 writer for stdout and stderr. The error no longer appears.
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-12-04 19:56:04 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:
Bug Depends On:    
Bug Blocks: 863461    

Description Lijun Li 2012-09-20 07:47:28 UTC
Description of problem:
Run 'kateloo --help' with UTF-8 locale produced traceback: 'ascii' codec can't encode characters in position.

Version-Release number of selected component (if applicable):
katello-1.1.12-7.el6cf.noarch
katello-cli-1.1.8-4.el6cf.noarch

How reproducible:
100%

Steps to Reproduce:
1. Install latest CloudForms System Engine build.
2. Run from terminal:
LANG=ja_JP.UTF-8 katello --help
  
Actual results:
[root@cfsetest ~]# LANG=ja_JP.UTF-8 katello --help
error: 'ascii' codec can't encode characters in position 80-101: ordinal not in range(128) (more in the log file /var/log/katello/client.log)
You have mail in /var/spool/mail/root
[root@cfsetest ~]# cat /var/log/katello/client.log 
2012-09-19 21:08:13,596 [ERROR][MainThread] error() @ base.py:184 - 'ascii' codec can't encode characters in position 80-101: ordinal not in range(128)
2012-09-19 21:08:13,597 [ERROR][MainThread] error() @ base.py:185 - Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/katello/client/cli/base.py", line 197, in main
    ret_code = super(KatelloCLI, self).main(args, command_name, parent_usage)
  File "/usr/lib/python2.6/site-packages/katello/client/core/base.py", line 293, in main
    self.process_options(parser, args)
  File "/usr/lib/python2.6/site-packages/katello/client/core/base.py", line 211, in process_options
    self.opts, self.args = parser.parse_args(args)
  File "/usr/lib64/python2.6/optparse.py", line 1394, in parse_args
    stop = self._process_args(largs, rargs, values)
  File "/usr/lib64/python2.6/optparse.py", line 1434, in _process_args
    self._process_long_opt(rargs, values)
  File "/usr/lib64/python2.6/optparse.py", line 1509, in _process_long_opt
    option.process(opt, value, values, self)
  File "/usr/lib64/python2.6/optparse.py", line 788, in process
    self.action, self.dest, opt, value, values, parser)
  File "/usr/lib64/python2.6/optparse.py", line 810, in take_action
    parser.print_help()
  File "/usr/lib/python2.6/site-packages/katello/client/i18n_optparse.py", line 76, in print_help
    out_file.write(self.format_help())
UnicodeEncodeError: 'ascii' codec can't encode characters in position 80-101: ordinal not in range(128)


Expected results:
No Traceback.

Additional info:

Comment 3 Ivan Necas 2012-10-05 10:29:31 UTC
This issue is somehow related to https://bugzilla.redhat.com/show_bug.cgi?id=845198#c10

Like this problem, it occurs only with environment with LC_CTYPE=en_US.UTF-8

Comment 4 Ivan Necas 2012-10-05 12:56:39 UTC
The fix is merged to katello https://github.com/Katello/katello/pull/798

  Branch: refs/heads/master
  Home:   https://github.com/Katello/katello
  Commit: d650484f2c66df5ef8a11179a17094091fdfca65
      https://github.com/Katello/katello/commit/d650484f2c66df5ef8a11179a17094091fdfca65
  Author: Ivan Necas <inecas>
  Date:   2012-10-05 (Fri, 05 Oct 2012)

  Changed paths:
    M cli/src/katello/client/utils/encoding.py

  Log Message:
  -----------
  858960 - always set the utf-8 writer for stdout and stderr

Comment 7 Og Maciel 2012-10-08 21:55:25 UTC
# LANG=ja_JP.UTF8 katello -u admin -p admin --help
Usage:  katello <options> <command>
Supported Commands:
	activation_key Katello サーバーのアクティベーションキーに固有の動作
	admin          各種管理動作
	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   katello サーバーでのシステムグループ固有の動作
	template       Katello サーバーのテンプレートに固有の動作
	user           Katello サーバーでのユーザー固有の動作
	user_role      katello サーバー内でのユーザーロール固有の動作
	version        katello サーバーのバージョンを取得

Options:
  -h, --help            show this help message and exit
  -v, --version         バージョン情報を表示します
  -d, --debug           デバッグ情報をログに送信します

  Katello ユーザーアカウントの資格情報:
    -u USERNAME, --username=USERNAME
                        アカウントのユーザー名
    -p PASSWORD, --password=PASSWORD
                        アカウントのパスワード

  Katello サーバー情報:
    --host=HOST         Katello サーバーのホスト名 (デフォルト: localhost.localdomain)

Comment 8 Og Maciel 2012-10-08 21:55:56 UTC
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 10 errata-xmlrpc 2012-12-04 19:56:04 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.

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

Comment 11 Mike McCune 2013-08-16 18:00:24 UTC
getting rid of 6.0.0 version since that doesn't exist