Bug 1850347

Summary: The validator log management is broken due to unwanted "encode()" calls
Product: Red Hat OpenStack Reporter: Cédric Jeanneret <cjeanner>
Component: python-tripleoclientAssignee: Cédric Jeanneret <cjeanner>
Status: CLOSED ERRATA QA Contact: Jad Haj Yahya <jhajyahy>
Severity: high Docs Contact:
Priority: high    
Version: 16.1 (Train)CC: egallen, hbrock, jslagle, mburns, sclewis
Target Milestone: rcKeywords: Triaged
Target Release: 16.1 (Train on RHEL 8.2)   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-tripleoclient-12.3.2-0.20200615103427.6f877f6.el8ost Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-07-29 07:53:29 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: 1836797    

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