Skip to content

Commit

Permalink
Use new leapp output apis
Browse files Browse the repository at this point in the history
Leapp introduced new output apis (and removed some other).
See oamg/leapp#840 for details.

The calls to `generate_report_file()` in `commands/upgrade/utils.py` are
swapped to workaround a bug in the framework where the json report
generation modifies messages passed to it.

Jira: OAMG-9663
  • Loading branch information
matejmatuska authored and pirat89 committed Aug 23, 2023
1 parent 46289e0 commit 3bc4203
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
5 changes: 2 additions & 3 deletions commands/preupgrade/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from leapp.logger import configure_logger
from leapp.utils.audit import Execution
from leapp.utils.clicmd import command, command_opt
from leapp.utils.output import beautify_actor_exception, report_errors, report_info, report_inhibitors
from leapp.utils.output import beautify_actor_exception, report_errors, report_info


@command('preupgrade', help='Generate preupgrade report')
Expand Down Expand Up @@ -77,10 +77,9 @@ def preupgrade(args, breadcrumbs):
workflow.save_answers(answerfile_path, userchoices_path)
util.generate_report_files(context, report_schema)
report_errors(workflow.errors)
report_inhibitors(context)
report_files = util.get_cfg_files('report', cfg)
log_files = util.get_cfg_files('logs', cfg)
report_info(context, report_files, log_files, answerfile_path, fail=workflow.failure)
report_info(context, report_files, log_files, answerfile_path, fail=workflow.failure, errors=workflow.errors)

if workflow.failure:
sys.exit(1)
Expand Down
5 changes: 2 additions & 3 deletions commands/upgrade/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from leapp.logger import configure_logger
from leapp.utils.audit import Execution
from leapp.utils.clicmd import command, command_opt
from leapp.utils.output import beautify_actor_exception, report_errors, report_info, report_inhibitors
from leapp.utils.output import beautify_actor_exception, report_errors, report_info

# NOTE:
# If you are adding new parameters please ensure that they are set in the upgrade function invocation in `rerun`
Expand Down Expand Up @@ -106,11 +106,10 @@ def upgrade(args, breadcrumbs):
logger.info("Answerfile will be created at %s", answerfile_path)
workflow.save_answers(answerfile_path, userchoices_path)
report_errors(workflow.errors)
report_inhibitors(context)
util.generate_report_files(context, report_schema)
report_files = util.get_cfg_files('report', cfg)
log_files = util.get_cfg_files('logs', cfg)
report_info(context, report_files, log_files, answerfile_path, fail=workflow.failure)
report_info(context, report_files, log_files, answerfile_path, fail=workflow.failure, errors=workflow.errors)

if workflow.failure:
sys.exit(1)
Expand Down
2 changes: 1 addition & 1 deletion commands/upgrade/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ def generate_report_files(context, report_schema):
'leapp-report.{}'.format(f)) for f in ['txt', 'json']]
# fetch all report messages as a list of dicts
messages = fetch_upgrade_report_messages(context)
generate_report_file(messages, context, report_json, report_schema)
generate_report_file(messages, context, report_txt, report_schema)
generate_report_file(messages, context, report_json, report_schema)


def get_cfg_files(section, cfg, must_exist=True):
Expand Down
2 changes: 1 addition & 1 deletion packaging/leapp-repository.spec
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Requires: leapp-repository-dependencies = %{leapp_repo_deps}

# IMPORTANT: this is capability provided by the leapp framework rpm.
# Check that 'version' instead of the real framework rpm version.
Requires: leapp-framework >= 4.0, leapp-framework < 5
Requires: leapp-framework >= 5.0, leapp-framework < 6

# Since we provide sub-commands for the leapp utility, we expect the leapp
# tool to be installed as well.
Expand Down

0 comments on commit 3bc4203

Please sign in to comment.