Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1372146

Summary: [Satellite5.7] It will show "UnicodeDecodeError:" when run virt-who with wrong "encrypted_password" in /etc/virt-who.d/xxx
Product: Red Hat Enterprise Linux 7 Reporter: Liushihui <shihliu>
Component: virt-whoAssignee: Chris Snyder <csnyder>
Status: CLOSED CURRENTRELEASE QA Contact: Eko <hsun>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3CC: khowell, ldai, redakkan, sgao, yuefliu
Target Milestone: rcKeywords: Triaged
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-12-11 10:21:41 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 Liushihui 2016-09-01 03:21:56 UTC
Description of problem:
When configure "encrypted_password" with wrong value, start virt-who will show "UnicodeDecodeError: 'ascii' codec can't decode byte 0xdf in position 15: ordinal not in range(128)" in rhsm.log

Version-Release number of selected component (if applicable):
virt-who-0.17-10.el7.noarch
subscription-manager-1.17.10-1.el7.x86_64
python-rhsm-1.17.6-1.el7.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Generate encrypted password with virt-who-password.
[root@hp-z220-04 virt-who.d]# virt-who-password 
Password: 
Use following as value for encrypted_password key in the configuration file:
bc49696be3ac62ce89defe9fd80f5d33

2. Run virt-who with wrong "encrypted_password" in /etc/virt-who.d/XX
[root@hp-z220-04 virt-who.d]# cat /etc/virt-who.d/rhevm 
[test-rhevm1]
type=rhevm
server=https://tyan-gt24-04.rhts.eng.bos.redhat.com:443/ovirt-engine/
username=admin@internal
encrypted_password=43f282d679adb816f2bb1cf9c18949ec
owner=ACME_Corporation
env=Library
sat_server=10.73.3.209
sat_username=admin
sat_password=redhat

3. Restart virt-who service and check virt-who's log
[root@hp-z220-04 virt-who.d]# service virt-who restart&&tail -f /var/log/rhsm/rhs.log
2016-08-31 22:33:04,610 [virtwho.test-rhevm1 ERROR] RhevM-1(14996):MainThread @virt.py:run:379 - Virt backend 'test-rhevm1' fails with exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/virtwho/virt/virt.py", line 372, in run
    self._run()
  File "/usr/lib/python2.7/site-packages/virtwho/virt/virt.py", line 409, in _run
    report = self._get_report()
  File "/usr/lib/python2.7/site-packages/virtwho/virt/virt.py", line 334, in _get_report
    return HostGuestAssociationReport(self.config, self.getHostGuestMapping())
  File "/usr/lib/python2.7/site-packages/virtwho/virt/rhevm/rhevm.py", line 116, in getHostGuestMapping
    clusters_xml = self.get_xml(self.clusters_url)
  File "/usr/lib/python2.7/site-packages/virtwho/virt/rhevm/rhevm.py", line 96, in get_xml
    response = self.get(url)
  File "/usr/lib/python2.7/site-packages/virtwho/virt/rhevm/rhevm.py", line 85, in get
    response = requests.get(url, auth=self.auth, verify=False)
  File "/usr/lib/python2.7/site-packages/requests/api.py", line 68, in get
    return request('get', url, **kwargs)
  File "/usr/lib/python2.7/site-packages/requests/api.py", line 50, in request
    response = session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 450, in request
    prep = self.prepare_request(req)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 381, in prepare_request
    hooks=merge_hooks(request.hooks, self.hooks),
  File "/usr/lib/python2.7/site-packages/requests/models.py", line 308, in prepare
    self.prepare_auth(auth, url)
  File "/usr/lib/python2.7/site-packages/requests/models.py", line 495, in prepare_auth
    r = auth(self)
  File "/usr/lib/python2.7/site-packages/requests/auth.py", line 50, in __call__
    r.headers['Authorization'] = _basic_auth_str(self.username, self.password)
  File "/usr/lib/python2.7/site-packages/requests/auth.py", line 30, in _basic_auth_str
    b64encode(('%s:%s' % (username, password)).encode('latin1')).strip()
UnicodeDecodeError: 'ascii' codec can't decode byte 0xdf in position 15: ordinal not in range(128)


Actual results:
It will show "UnicodeDecodeError: 'ascii' codec can't decode byte 0xdf in position 15: ordinal not in range(128)" in the log.

Expected results:
It should show "2016-08-31 22:45:50,738 [virtwho.test-rhevm1 ERROR] RhevM-1(10066):MainThread @virt.py:run:375 - Virt backend 'test-rhevm1' fails with error: Unable to connect to RHEV-M server: 401 Client Error: Unauthorized
"

Additional info:
It hasn't the problem on satellite6.2.1

Comment 2 Chris Snyder 2017-06-07 20:28:11 UTC
I am unable to reproduce following the above steps. This appears to have been fixed.

Liushihui,

Can you verify if this is still an issue in the latest virt-who available in RHEL 7.4?

Comment 3 Liushihui 2017-06-08 07:34:15 UTC
It hasn't this problem on latest virt-who-0.19-5.el7.noarch(RHEL7.4). In the latest version ,it will correct to show "WebFault: Server raised fault: 'Cannot complete login due to an incorrect user name or password.'"
Therefore, verify it. Thanks.

Comment 5 Rehana 2020-12-11 10:21:41 UTC
Old bug clean up :
================

Closing the bug with Current release ,the bug was verified by QE during a RHEL release cycle but was not closed.