Bug 1850347 - The validator log management is broken due to unwanted "encode()" calls
Summary: The validator log management is broken due to unwanted "encode()" calls
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: python-tripleoclient
Version: 16.1 (Train)
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: rc
: 16.1 (Train on RHEL 8.2)
Assignee: Cédric Jeanneret
QA Contact: Jad Haj Yahya
URL:
Whiteboard:
Depends On:
Blocks: 1836797
TreeView+ depends on / blocked
 
Reported: 2020-06-24 06:26 UTC by Cédric Jeanneret
Modified: 2020-07-29 07:54 UTC (History)
5 users (show)

Fixed In Version: python-tripleoclient-12.3.2-0.20200615103427.6f877f6.el8ost
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-07-29 07:53:29 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
OpenStack gerrit 737685 0 None MERGED [TRAIN ONLY] Do not encode hostnames in validation result 2020-07-06 06:35:35 UTC
Red Hat Product Errata RHBA-2020:3148 0 None None None 2020-07-29 07:54:39 UTC

Description Cédric Jeanneret 2020-06-24 06:26:05 UTC
When running a validation, or showing a past run, we end with this trace:

(undercloud) [stack@undercloud-0 ~]$ openstack tripleo validator run --validation undercloud-disk-space                                                                                                                                       
/usr/lib/python3.6/site-packages/tripleoclient/v1/tripleo_validator.py:437: ResourceWarning: unclosed file <_io.BufferedReader name=7>
  gathering_policy=gathering_policy)                                        
Exception occured while running the command         
Traceback (most recent call last):                                                                       
  File "/usr/lib/python3.6/site-packages/tripleoclient/command.py", line 32, in run
    super(Command, self).run(parsed_args)                                                                       
  File "/usr/lib/python3.6/site-packages/osc_lib/command/command.py", line 41, in run
    return super(Command, self).run(parsed_args)              
  File "/usr/lib/python3.6/site-packages/cliff/command.py", line 185, in run
    return_code = self.take_action(parsed_args) or 0                                                                                                                                   
  File "/usr/lib/python3.6/site-packages/tripleoclient/v1/tripleo_validator.py", line 613, in take_action
    self._run_validator_run(parsed_args)  
  File "/usr/lib/python3.6/site-packages/tripleoclient/v1/tripleo_validator.py", line 568, in _run_validator_run
    if contents['stats'][ht]['unreachable'] != 0:                                                                                     
KeyError: b'undercloud'             
b'undercloud'
sys:1: ResourceWarning: unclosed <ssl.SSLSocket fd=4, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.24.2', 37316), raddr=('192.168.24.2', 13000)>


This is due to a call to "encode('utf8') for the hostname, preventing correct matching in the dict.

Once we correct this first issue, we end up with a second trace:

(undercloud) [stack@undercloud-0 ~]$ openstack tripleo validator run --validation undercloud-disk-space                                                                                                                                       
/usr/lib/python3.6/site-packages/tripleoclient/v1/tripleo_validator.py:437: ResourceWarning: unclosed file <_io.BufferedReader name=7>                                                                                                        
  gathering_policy=gathering_policy)                                                                                                                                                                                                          
Exception occured while running the command                                                                                                                                                                                                   
Traceback (most recent call last):                                                                                                                                                                                                            
  File "/usr/lib/python3.6/site-packages/tripleoclient/command.py", line 32, in run                                                                                                  
    super(Command, self).run(parsed_args)                                                                                                                                              
  File "/usr/lib/python3.6/site-packages/osc_lib/command/command.py", line 41, in run                                                                                                                                                         
    return super(Command, self).run(parsed_args)                                                                                      
  File "/usr/lib/python3.6/site-packages/cliff/command.py", line 185, in run
    return_code = self.take_action(parsed_args) or 0
  File "/usr/lib/python3.6/site-packages/tripleoclient/v1/tripleo_validator.py", line 613, in take_action
    self._run_validator_run(parsed_args)                                           
  File "/usr/lib/python3.6/site-packages/tripleoclient/v1/tripleo_validator.py", line 577, in _run_validator_run
    r.append(", ".join(host))                                                        
TypeError: sequence item 0: expected str instance, bytes found
sequence item 0: expected str instance, bytes found                         
sys:1: ResourceWarning: unclosed <ssl.SSLSocket fd=4, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.24.2', 54204), raddr=('192.168.24.2', 13000)>

This is due to the very same call to "encode()", in a different place.

Comment 13 errata-xmlrpc 2020-07-29 07:53:29 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-2020:3148


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