Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RHELC-1055] Change the default message of an empty report message field #945

Merged
merged 1 commit into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion convert2rhel/actions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ def format_action_status_message(status_code, action_id, id, result):
"""
level_name = _STATUS_NAME_FROM_CODE[status_code]
template = "({LEVEL}) {ACTION_ID}::{ID} -"
default_message = "[No further information given]"
default_message = "N/A"

# Success results doesn't need to have id, title or anything else. Instead,
# we can output a simple message with the addition of the `No further
Expand Down
2 changes: 1 addition & 1 deletion convert2rhel/actions/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def summary(results, include_all_reports=False, with_colors=True):

In case of `message` being empty (as it is optional for some cases), a
default message will be used::
* (ERROR) SubscribeSystem.ERROR: [No further information given]
* (ERROR) SubscribeSystem.ERROR: N/A

In case of all actions executed without warnings or errors, the
following message is used::
Expand Down
6 changes: 3 additions & 3 deletions convert2rhel/unit_tests/actions/actions_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1843,7 +1843,7 @@ def test_action_result_success(self, level, id, title, description, diagnosis, r
"Test",
"SUCCESS",
{},
"(SUCCESS) Test::SUCCESS - [No further information given]",
"(SUCCESS) Test::SUCCESS - N/A",
),
(
STATUS_CODE["WARNING"],
Expand All @@ -1867,7 +1867,7 @@ def test_action_result_success(self, level, id, title, description, diagnosis, r
"diagnosis": "A normal diagnosis",
"remediation": "A normal remediation",
},
"(ERROR) Test::TestID - A normal title\n Description: [No further information given]\n Diagnosis: A normal diagnosis\n Remediation: A normal remediation\n",
"(ERROR) Test::TestID - A normal title\n Description: N/A\n Diagnosis: A normal diagnosis\n Remediation: A normal remediation\n",
),
(
STATUS_CODE["ERROR"],
Expand All @@ -1879,7 +1879,7 @@ def test_action_result_success(self, level, id, title, description, diagnosis, r
"diagnosis": "",
"remediation": "",
},
"(ERROR) Test::TestID - A normal title\n Description: [No further information given]\n Diagnosis: [No further information given]\n Remediation: [No further information given]\n",
"(ERROR) Test::TestID - A normal title\n Description: N/A\n Diagnosis: N/A\n Remediation: N/A\n",
),
),
)
Expand Down
12 changes: 5 additions & 7 deletions convert2rhel/unit_tests/actions/report_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def test_summary_as_json(results, expected, tmpdir):
True,
[
"(WARNING) PreSubscription::WARNING_ID - Warning\n Description: Action warning\n Diagnosis: User warning\n Remediation: move on",
"(SUCCESS) PreSubscription::SUCCESS - [No further information given]",
"(SUCCESS) PreSubscription::SUCCESS - N/A",
],
),
(
Expand Down Expand Up @@ -197,7 +197,7 @@ def test_summary_as_json(results, expected, tmpdir):
},
True,
[
"(SUCCESS) PreSubscription::SUCCESS - [No further information given]",
"(SUCCESS) PreSubscription::SUCCESS - N/A",
"(WARNING) PreSubscription2::WARNING_ID - Warning\n Description: Action warning\n Diagnosis: User warning\n Remediation: move on",
"(SKIP) PreSubscription2::SKIPPED - Skip\n Description: Action skip\n Diagnosis: User skip\n Remediation: move on",
],
Expand Down Expand Up @@ -710,7 +710,7 @@ def test_messages_summary_with_long_message(long_message, caplog):
r"\(ERROR\) ErrorAction::ERROR - Error\n Description: Action error\n Diagnosis: User error\n Remediation: move on",
r"\(OVERRIDABLE\) OverridableAction::OVERRIDABLE - Overridable\n Description: Action override\n Diagnosis: User override\n Remediation: move on",
r"\(SKIP\) SkipAction::SKIP - Skip\n Description: Action skip\n Diagnosis: User skip\n Remediation: move on",
r"\(SUCCESS\) PreSubscription::SUCCESS - \[No further information given\]",
r"\(SUCCESS\) PreSubscription::SUCCESS - N/A",
],
),
),
Expand Down Expand Up @@ -947,7 +947,7 @@ def test_results_summary_ordering(results, include_all_reports, expected_results
"(WARNING) SkipAction::WARNING_ID - Warning\n Description: Action warning\n Diagnosis: User warning\n Remediation: move on",
"(WARNING) OverridableAction::WARNING_ID - Warning\n Description: Action warning\n Diagnosis: User warning\n Remediation: move on",
"(WARNING) ErrorAction::WARNING_ID - Warning\n Description: Action warning\n Diagnosis: User warning\n Remediation: move on",
"(SUCCESS) PreSubscription::SUCCESS - [No further information given]",
"(SUCCESS) PreSubscription::SUCCESS - N/A",
],
),
),
Expand Down Expand Up @@ -1092,9 +1092,7 @@ def test_messages_summary_ordering(results, include_all_reports, expected_result
},
)
},
"{begin}(SUCCESS) SuccessfulAction::SUCCESS - [No further information given]{end}".format(
begin=bcolors.OKGREEN, end=bcolors.ENDC
),
"{begin}(SUCCESS) SuccessfulAction::SUCCESS - N/A{end}".format(begin=bcolors.OKGREEN, end=bcolors.ENDC),
"{begin}(WARNING) SuccessfulAction::WARNING_ID - Warning\n Description: Action warning\n Diagnosis: User warning\n Remediation: move on{end}".format(
begin=bcolors.WARNING, end=bcolors.ENDC
),
Expand Down
Loading