Skip to content

Commit

Permalink
Show errors as inhibitors in UI too
Browse files Browse the repository at this point in the history
errors are in an essence inhibitors too, yo ucan't upgrade without resolving them - this is menat to keep UI clean and user-friendly

Signed-off-by: Andrea Waltlova <[email protected]>
  • Loading branch information
andywaltlova committed Feb 5, 2024
1 parent 9da5b85 commit 068680b
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 8 deletions.
5 changes: 2 additions & 3 deletions playbooks/leapp_preupgrade_ansible.yml
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
"entries": report_content_edited.entries | default([]) +
[
entry | combine(
{"severity": "error"} if "error" in entry.groups | default([]) else
{"severity": "inhibitor"} if "error" in entry.groups | default([]) else
{"severity": "inhibitor"} if "inhibitor" in entry.groups | default([]) else {}
)
]
Expand All @@ -219,8 +219,7 @@
set_fact:
message: >-
"The upgrade cannot proceed.
Your system has {{ error_count }} error{{ 's' if error_count != 1 else '' }}
and {{ inhibitor_count }} inhibitor{{ 's' if inhibitor_count != 1 else '' }}
Your system has {{ error_count + inhibitor_count }} inhibitor{{ 's' if inhibitor_count + error_count != 1 else '' }}
out of {{ total_problems_count }} potential problems."
when: inhibitor_count != 0 or error_count != 0

Expand Down
2 changes: 1 addition & 1 deletion playbooks/leapp_preupgrade_script.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@
# NOTE: "severity" key in report is connected to tasks-frontend severity maps
# Every change must come with change to severity maps otherwise UI will throw sentry errors
if "error" in groups:
entry["severity"] = "error"
entry["severity"] = "inhibitor"
elif "inhibitor" in groups:
entry["severity"] = "inhibitor"
Expand Down
2 changes: 1 addition & 1 deletion playbooks/leapp_upgrade_ansible.yml
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@
"entries": report_content_edited.entries | default([]) +
[
entry | combine(
{"severity": "error"} if "error" in entry.groups | default([]) else
{"severity": "inhibitor"} if "error" in entry.groups | default([]) else
{"severity": "inhibitor"} if "inhibitor" in entry.groups | default([]) else {}
)
]
Expand Down
2 changes: 1 addition & 1 deletion playbooks/leapp_upgrade_script.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@
# NOTE: "severity" key in report is connected to tasks-frontend severity maps
# Every change must come with change to severity maps otherwise UI will throw sentry errors
if "error" in groups:
entry["severity"] = "error"
entry["severity"] = "inhibitor"
elif "inhibitor" in groups:
entry["severity"] = "inhibitor"
Expand Down
2 changes: 1 addition & 1 deletion scripts/leapp_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def parse_results(output, reboot_required=False):
# NOTE: "severity" key in report is connected to tasks-frontend severity maps
# Every change must come with change to severity maps otherwise UI will throw sentry errors
if "error" in groups:
entry["severity"] = "error"
entry["severity"] = "inhibitor"
elif "inhibitor" in groups:
entry["severity"] = "inhibitor"

Expand Down
2 changes: 1 addition & 1 deletion tests/test_parse_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_gather_report_files_exist(mock_find_level, mock_exists, groups_value):
assert mock_exists.call_count == 2
assert output.report == test_txt_content
assert output.report_json.get("entries") is not None
assert output.report_json.get("entries")[0]["severity"] == groups_value
assert output.report_json.get("entries")[0]["severity"] == "inhibitor"

num_errors = test_json_content.count("error")
errors_str = "%s error%s" % (num_errors, "" if num_errors == 1 else "s")
Expand Down

0 comments on commit 068680b

Please sign in to comment.