analyze-migration.py: fix read_migration_debug_json() return type

Since we use result of read_migration_debug_json() as JSON formatted string,
we must provide proper type. Before Python 3.6 json.loads() method
support only str typed input.

Signed-off-by: Alexey Kirillov <lekiravi@yandex-team.ru>
Message-Id: <20200715152135.20287-1-lekiravi@yandex-team.ru>
[ehabkost: added comment explaining why decode() is needed}
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
Alexey Kirillov 2020-07-15 18:21:35 +03:00 committed by Eduardo Habkost
parent 1b7306f5dd
commit 14f9cec713
1 changed files with 2 additions and 1 deletions

View File

@ -97,7 +97,8 @@ class MigrationFile(object):
# Seek back to where we were at the beginning
self.file.seek(entrypos, 0)
return data[jsonpos:jsonpos + jsonlen]
# explicit decode() needed for Python 3.5 compatibility
return data[jsonpos:jsonpos + jsonlen].decode("utf-8")
def close(self):
self.file.close()