Don't encode to utf8 data read from logfile

In python3 all strings are stored as unicode in an instance of the str type.
Encoded strings on the other hand are represented as binary data in the form
of instances of the bytes type.

In https://review.opendev.org/714280 we changed to not write in binary mode.

Story: 2007449

Change-Id: I799c7cad76fd03ee45d3624feb5a7210f9ce8bf5
This commit is contained in:
Rabi Mishra 2020-03-22 08:40:55 +05:30
parent e7693eb1ae
commit 39a9e8aa15
1 changed files with 2 additions and 6 deletions

View File

@ -525,10 +525,7 @@ class TripleOValidatorRun(command.Command):
contents = json.load(val)
for i in contents['plays']:
host = [
x.encode('utf-8')
for x in i['play'].get('host').split(', ')
]
host = [x for x in i['play'].get('host').split(', ')]
val_id = i['play'].get('validation_id')
time_elapsed = \
i['play']['duration'].get('time_elapsed', None)
@ -542,8 +539,7 @@ class TripleOValidatorRun(command.Command):
unreachable_hosts = []
hosts_result = []
for h in list(contents['stats'].keys()):
ht = h.encode('utf-8')
for ht in list(contents['stats'].keys()):
if contents['stats'][ht]['unreachable'] != 0:
unreachable_hosts.append(ht)
elif contents['stats'][ht]['failures'] != 0: