RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1766445 - UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 55: ordinal not in range(128)
Summary: UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position ...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: subscription-manager
Version: 7.7
Hardware: All
OS: Linux
unspecified
high
Target Milestone: rc
: ---
Assignee: Jiri Hnidek
QA Contact: Red Hat subscription-manager QE Team
URL:
Whiteboard:
Depends On:
Blocks: 1752522
TreeView+ depends on / blocked
 
Reported: 2019-10-29 04:50 UTC by Douglas Schilling Landgraf
Modified: 2020-01-22 18:54 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-01-22 18:54:29 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github candlepin subscription-manager pull 2179 0 'None' closed managercli: use encode('utf-8') in strings 2021-01-17 17:23:50 UTC

Description Douglas Schilling Landgraf 2019-10-29 04:50:22 UTC
Description of problem:

If users with non US unicode try to enable a repository that is already enabled subscription-manager will raise an Unicode error.

Version-Release number of selected component (if applicable):

RHEL 7 family:

# rpm -qa | grep subscription-manager
subscription-manager-rhsm-1.24.23-1.el7.x86_64
subscription-manager-rhsm-certificates-1.24.23-1.el7.x86_64
subscription-manager-1.24.23-1.el7.x86_64

or 

subscription-manager-rhsm-1.24.13-3.el7_7.x86_64
subscription-manager-rhsm-certificates-1.24.13-3.el7_7.x86_64
subscription-manager-1.24.13-3.el7_7.x86_64


How reproducible:
1. Edit the locale, example:
# cat /etc/locale.conf 
LANG=fr_FR.UTF-8
LC_CTYPE="fr_FR.UTF-8"
LC_NUMERIC="fr_FR.UTF-8"
LC_TIME="fr_FR.UTF-8"
LC_COLLATE="fr_FR.UTF-8"
LC_MONETARY="fr_FR.UTF-8"
LC_MESSAGES="fr_FR.UTF-8"
LC_PAPER="fr_FR.UTF-8"
LC_NAME="fr_FR.UTF-8"
LC_ADDRESS="fr_FR.UTF-8"
LC_TELEPHONE="fr_FR.UTF-8"
LC_MEASUREMENT="fr_FR.UTF-8"
LC_IDENTIFICATION="fr_FR.UTF-8"
LC_ALL=

2. Reboot

3. Try to enable a repo which is already enabled
# env LC_ALL=C subscription-manager repos --enable rhel-7-server-rhv-4.3-manager-rpms --enable jb-eap-7.2-for-rhel-7-server-rpms
Traceback (most recent call last):
  File "/usr/sbin/subscription-manager", line 9, in <module>
    load_entry_point('subscription-manager==1.24.13', 'console_scripts', 'subscription-manager')()
  File "/usr/lib64/python2.7/site-packages/subscription_manager/scripts/subscription_manager.py", line 85, in main
    return managercli.ManagerCLI().main()
  File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 2922, in main
    ret = CLI.main(self)
  File "/usr/lib64/python2.7/site-packages/subscription_manager/cli.py", line 183, in main
    return cmd.main()
  File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 506, in main
    return_code = self._do_command()
  File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 2260, in _do_command
    rc = self._set_repo_status(repos, rl, self.options.repo_actions)
  File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 2358, in _set_repo_status
    print(_("Repository '%s' is enabled for this system.") % repo.id)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 4: ordinal not in range(128)

Actual results:
raised Unicode error

Expected results:
Just print a error message to users (not UnicodeEncodeError raise)

Comment 2 Douglas Schilling Landgraf 2019-10-29 04:55:58 UTC
Proposal patch: https://github.com/candlepin/subscription-manager/pull/2179

Comment 3 Douglas Schilling Landgraf 2020-01-22 18:54:29 UTC
Using env -i LC_ALL=C  solves the issue. Thanks!


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