Bug 1492074

Summary: Problem with virt-who using Unicode characters in a hypervisor's account password
Product: Red Hat Enterprise Linux 7 Reporter: Jiri Vavra <jivavra>
Component: virt-whoAssignee: Jiri Hnidek <jhnidek>
Status: CLOSED ERRATA QA Contact: Eko <hsun>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.4CC: csnyder, gsapienz, khowell, salmy, yuefliu
Target Milestone: rcKeywords: Triaged
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: 2018-10-30 10:47:13 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: 1461138    

Description Jiri Vavra 2017-09-15 12:02:14 UTC
Description of problem:
Problem with virt-who using Unicode characters in a hypervisor's account password.

This bug is same as 1357761 [1] but for virt-who on RHEL 7

Version-Release number of selected component (if applicable):
RHEL 7.4
virt-who-0.19-6.el7_4.noarch

How reproducible:
100%

Steps to Reproduce:
1. In VMWare create user, which has password with UTF character, e.g. 123€abc!
2. Install virt-who and configure to grab info from ESX
3. Enter password with UTF to .conf file Can be both as "password" or "encrypted_password"

Actual results:
Password with the UTF character is not processed. 

Expected results:
Password to hypervisor's account can contain UTF character

Additional info:

Error with latest virt-who
~~~
Option 'password' is not in latin1 encoding
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/virtwho/__main__.py", line 11, in main
    res = virtwho.main.main()
  File "/usr/lib/python2.7/site-packages/virtwho/main.py", line 129, in main
    executor = Executor(logger, options)
  File "/usr/lib/python2.7/site-packages/virtwho/executor.py", line 49, in __init__
    self.configManager = ConfigManager(self.logger, config_dir)
  File "/usr/lib/python2.7/site-packages/virtwho/config.py", line 556, in __init__
    self._readConfig(parser)
  File "/usr/lib/python2.7/site-packages/virtwho/config.py", line 573, in _readConfig
    config = Config.fromParser(section, parser, self._defaults)
  File "/usr/lib/python2.7/site-packages/virtwho/config.py", line 481, in fromParser
    config = Config(name, type, defaults, **options)
  File "/usr/lib/python2.7/site-packages/virtwho/config.py", line 415, in __init__
    raise InvalidOption("Option '{}' is not in latin1 encoding".format(option))
InvalidOption: Option 'password' is not in latin1 encoding
No handlers could be found for logger "virtwho.main"
~~~

Tried virt-who from github, which should have it fixed, error:
~~~
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/virt_who-0.20.4-py2.7.egg/virtwho/virt/virt.py", line 380, in run
    self._run()
  File "/usr/lib/python2.7/site-packages/virt_who-0.20.4-py2.7.egg/virtwho/virt/esx/esx.py", line 145, in _run
    self._prepare()
  File "/usr/lib/python2.7/site-packages/virt_who-0.20.4-py2.7.egg/virtwho/virt/esx/esx.py", line 133, in _prepare
    self.login()
  File "/usr/lib/python2.7/site-packages/virt_who-0.20.4-py2.7.egg/virtwho/virt/esx/esx.py", line 353, in login
    self.client.service.Login(_this=self.sc.sessionManager, userName=self.username, password=self.password)
  File "/usr/lib/python2.7/site-packages/suds/client.py", line 566, in __call__
    return client.invoke(args, kwargs)
  File "/usr/lib/python2.7/site-packages/suds/client.py", line 700, in invoke
    soapenv = binding.get_message(self.method, args, kwargs)
  File "/usr/lib/python2.7/site-packages/suds/bindings/binding.py", line 122, in get_message
    content = self.bodycontent(method, args, kwargs)
  File "/usr/lib/python2.7/site-packages/suds/bindings/document.py", line 96, in bodycontent
    add_param, self.options().extraArgumentErrors)
  File "/usr/lib/python2.7/site-packages/suds/argparser.py", line 83, in parse_args
    return arg_parser(args, kwargs, extra_parameter_errors)
  File "/usr/lib/python2.7/site-packages/suds/argparser.py", line 108, in __call__
    self.__process_parameters()
  File "/usr/lib/python2.7/site-packages/suds/argparser.py", line 299, in __process_parameters
    self.__process_parameter(*pdef)
  File "/usr/lib/python2.7/site-packages/suds/argparser.py", line 294, in __process_parameter
    self.__in_choice_context(), value)
  File "/usr/lib/python2.7/site-packages/suds/bindings/document.py", line 87, in add_param
    p = self.mkparam(method, pdef, value)
  File "/usr/lib/python2.7/site-packages/suds/bindings/document.py", line 129, in mkparam
    return super(Document, self).mkparam(method, pdef, object)
  File "/usr/lib/python2.7/site-packages/suds/bindings/binding.py", line 244, in mkparam
    return marshaller.process(content)
  File "/usr/lib/python2.7/site-packages/suds/mx/core.py", line 55, in process
    self.append(document, content)
  File "/usr/lib/python2.7/site-packages/suds/mx/core.py", line 68, in append
    self.appender.append(parent, content)
  File "/usr/lib/python2.7/site-packages/suds/mx/appender.py", line 86, in append
    appender.append(parent, content)
  File "/usr/lib/python2.7/site-packages/suds/mx/appender.py", line 182, in append
    child.setText(tostr(content.value))
  File "/usr/lib/python2.7/site-packages/suds/sax/element.py", line 259, in setText
    value = Text(value)
  File "/usr/lib/python2.7/site-packages/suds/sax/text.py", line 43, in __new__
    result = super(Text, cls).__new__(cls, *args, **kwargs)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 3: ordinal not in range(128)
~~~

I've built python2-suds-0.7-0.5.94664ddd46a6.el7.noarch.rpm but no success as well (same error)

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1357761

Comment 5 Jiri Hnidek 2018-01-31 14:04:37 UTC
I was able to verify that original PR did not solve the issue described in this bug report. I created PR with bug fix and I'm moving this bug report to state POST.

Comment 6 Eko 2018-02-01 02:47:37 UTC
*** Bug 1503271 has been marked as a duplicate of this bug. ***

Comment 19 errata-xmlrpc 2018-10-30 10:47:13 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-2018:3169