diff --git a/leapp/utils/report.py b/leapp/utils/report.py index 35e7f3176..ea172e815 100644 --- a/leapp/utils/report.py +++ b/leapp/utils/report.py @@ -90,6 +90,8 @@ def importance(message): def generate_report_file(messages_to_report, context, path, report_schema): + # NOTE(ivasilev) Int conversion should not break as only specific formats of report_schema versions are allowed + report_schema_tuple = tuple([int(x) for x in report_schema.split('.')]) if path.endswith(".txt"): with open(path, 'w') as f: for message in sorted(messages_to_report, key=importance): @@ -100,14 +102,14 @@ def generate_report_file(messages_to_report, context, path, report_schema): remediation = Remediation.from_dict(message.get('detail', {})) if remediation: f.write('Remediation: {}\n'.format(remediation)) - if not report_schema or report_schema > '1.0.0': + if report_schema_tuple > (1, 0, 0): # report-schema 1.0.0 doesn't have a stable report key f.write('Key: {}\n'.format(message['key'])) f.write('-' * 40 + '\n') elif path.endswith(".json"): with open(path, 'w') as f: # Here all possible convertions will take place - if report_schema < '1.1.0': + if report_schema_tuple < (1, 1, 0): # report-schema 1.0.0 doesn't have a stable report key # copy list of messages here not to mess the initial structure for possible further invocations messages_to_report = list(messages_to_report)