leapp-repository/SOURCES/0029-Allow-specifying-report-schema-1.2.0.patch

85 lines
4.1 KiB
Diff
Raw Normal View History

2022-06-23 17:24:45 +00:00
From 87048e486fd7b89609907fce9732d525932f0912 Mon Sep 17 00:00:00 2001
From: Inessa Vasilevskaya <ivasilev@redhat.com>
Date: Fri, 1 Apr 2022 12:40:02 +0200
Subject: [PATCH 29/39] Allow specifying --report-schema 1.2.0
This version will display actors' tags and flags as
groups in the final leapp report.
OAMG-1429
---
commands/preupgrade/__init__.py | 7 ++++---
commands/upgrade/__init__.py | 7 ++++---
commands/upgrade/util.py | 8 --------
3 files changed, 8 insertions(+), 14 deletions(-)
diff --git a/commands/preupgrade/__init__.py b/commands/preupgrade/__init__.py
index 46812b36..be2c7be8 100644
--- a/commands/preupgrade/__init__.py
+++ b/commands/preupgrade/__init__.py
@@ -27,8 +27,8 @@ from leapp.utils.output import beautify_actor_exception, report_errors, report_i
@command_opt('target', choices=command_utils.get_supported_target_versions(),
help='Specify RHEL version to upgrade to for {} detected upgrade flavour'.format(
command_utils.get_upgrade_flavour()))
-@command_opt('report-schema', help='Specify report schema version for leapp-report.json', choices=['1.0.0', '1.1.0'],
- default=get_config().get('report', 'schema'))
+@command_opt('report-schema', help='Specify report schema version for leapp-report.json',
+ choices=['1.0.0', '1.1.0', '1.2.0'], default=get_config().get('report', 'schema'))
@breadcrumbs.produces_breadcrumbs
def preupgrade(args, breadcrumbs):
util.disable_database_sync()
@@ -38,7 +38,8 @@ def preupgrade(args, breadcrumbs):
configuration = util.prepare_configuration(args)
answerfile_path = cfg.get('report', 'answerfile')
userchoices_path = cfg.get('report', 'userchoices')
- report_schema = util.process_report_schema(args, cfg)
+ # NOTE(ivasilev) argparse choices and defaults in enough for validation
+ report_schema = args.report_schema
if os.getuid():
raise CommandError('This command has to be run under the root user.')
diff --git a/commands/upgrade/__init__.py b/commands/upgrade/__init__.py
index b64e4d77..39bfd525 100644
--- a/commands/upgrade/__init__.py
+++ b/commands/upgrade/__init__.py
@@ -33,8 +33,8 @@ from leapp.utils.output import beautify_actor_exception, report_errors, report_i
@command_opt('target', choices=command_utils.get_supported_target_versions(),
help='Specify RHEL version to upgrade to for {} detected upgrade flavour'.format(
command_utils.get_upgrade_flavour()))
-@command_opt('report-schema', help='Specify report schema version for leapp-report.json', choices=['1.0.0', '1.1.0'],
- default=get_config().get('report', 'schema'))
+@command_opt('report-schema', help='Specify report schema version for leapp-report.json',
+ choices=['1.0.0', '1.1.0', '1.2.0'], default=get_config().get('report', 'schema'))
@breadcrumbs.produces_breadcrumbs
def upgrade(args, breadcrumbs):
skip_phases_until = None
@@ -49,7 +49,8 @@ def upgrade(args, breadcrumbs):
only_with_tags = args.only_with_tags if 'only_with_tags' in args else None
resume_context = args.resume_context if 'resume_context' in args else None
- report_schema = util.process_report_schema(args, cfg)
+ # NOTE(ivasilev) argparse choices and defaults in enough for validation
+ report_schema = args.report_schema
if os.getuid():
raise CommandError('This command has to be run under the root user.')
diff --git a/commands/upgrade/util.py b/commands/upgrade/util.py
index 22466ab7..ce0b5433 100644
--- a/commands/upgrade/util.py
+++ b/commands/upgrade/util.py
@@ -228,11 +228,3 @@ def process_whitelist_experimental(repositories, workflow, configuration, logger
if logger:
logger.error(msg)
raise CommandError(msg)
-
-
-def process_report_schema(args, configuration):
- default_report_schema = configuration.get('report', 'schema')
- if args.report_schema and args.report_schema > default_report_schema:
- raise CommandError('--report-schema version can not be greater that the '
- 'actual {} one.'.format(default_report_schema))
- return args.report_schema or default_report_schema
--
2.35.3