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

Improve message IDs #1447

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def run(self):
loggerinst.warning(description)
self.add_message(
level="WARNING",
id="LEFTOVER_BOOT_KERNEL_DETECTED",
id="LEFTOVER_DEFAULT_BOOT_KERNEL_DETECTED",
title="Leftover boot kernel detected",
description=description,
)
Expand Down
2 changes: 1 addition & 1 deletion convert2rhel/actions/pre_ponr_changes/handle_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def run(self):
logger.info(message)
self.add_message(
level="INFO",
id="SPECIAL_PACKAGES_REMOVED",
id="SPECIAL_PACKAGES_TO_REMOVE",
title="Special packages to be removed",
description=(
"We have identified installed packages that match a pre-defined list of packages that are"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def run(self):
else:
self.set_result(
level="OVERRIDABLE",
id="OUT_OF_DATE",
id="OUTDATED_CONVERT2RHEL_VERSION",
title="Outdated convert2rhel version detected",
description="An outdated convert2rhel version has been detected",
diagnosis=(
Expand Down
2 changes: 1 addition & 1 deletion convert2rhel/pkgmanager/handlers/dnf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def _process_transaction(self, validate_transaction):
logger.debug("Got the following exception message: %s", e)
logger.critical_no_exit("Failed to validate the dnf transaction.")
raise exceptions.CriticalError(
id_="FAILED_TO_VALIDATE_TRANSACTION",
id_="FAILED_TO_VALIDATE_DNF_TRANSACTION",
title="Failed to validate dnf transaction.",
description="During the dnf transaction execution an error occured and convert2rhel could no longer process the transaction.",
diagnosis="Transaction processing failed with error: {}".format(str(e)),
Expand Down
2 changes: 1 addition & 1 deletion convert2rhel/pkgmanager/handlers/yum/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ def _process_transaction(self, validate_transaction):
logger.debug("Got the following exception message: %s", e)
logger.critical_no_exit("Failed to validate the yum transaction.")
raise exceptions.CriticalError(
id_="FAILED_TO_VALIDATE_TRANSACTION",
id_="FAILED_TO_VALIDATE_YUM_TRANSACTION",
title="Failed to validate yum transaction.",
description="During the yum transaction execution an error occurred and convert2rhel could no longer process the transaction.",
diagnosis="Transaction processing failed with error: {}".format(" ".join(e.value)),
Expand Down
2 changes: 1 addition & 1 deletion convert2rhel/subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def register_system():
)
)
raise exceptions.CriticalError(
id_="FAILED_TO_SUBSCRIBE_SYSTEM",
id_="FAILED_TO_SUBSCRIBE_SYSTEM_ETC_OS_RELEASE",
title="Failed to subscribe system.",
description="Failed to restore the /etc/os-release file needed for subscribing the system.",
diagnosis="The restore failed with error {}.".format(str(e)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def test_run_all_removed(self, monkeypatch, remove_special_packages_instance):
(
actions.ActionMessage(
level="INFO",
id="SPECIAL_PACKAGES_REMOVED",
id="SPECIAL_PACKAGES_TO_REMOVE",
title="Special packages to be removed",
description="We have identified installed packages that match a pre-defined list of packages that are"
" to be removed during the conversion",
Expand Down Expand Up @@ -219,7 +219,7 @@ def test_run_packages_not_removed(self, pretend_os, monkeypatch, remove_special_
),
actions.ActionMessage(
level="INFO",
id="SPECIAL_PACKAGES_REMOVED",
id="SPECIAL_PACKAGES_TO_REMOVE",
title="Special packages to be removed",
description=(
"We have identified installed packages that match a pre-defined list of packages that are"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def test_convert2rhel_latest_outdated_version_inhibitor(
unit_tests.assert_actions_result(
convert2rhel_latest_action_instance,
level="OVERRIDABLE",
id="OUT_OF_DATE",
id="OUTDATED_CONVERT2RHEL_VERSION",
title="Outdated convert2rhel version detected",
diagnosis=(
"You are currently running {} and the latest version of convert2rhel is {}.\n"
Expand Down Expand Up @@ -485,7 +485,7 @@ def ttest_convert2rhel_latest_multiple_packages(
unit_tests.assert_actions_result(
convert2rhel_latest_action_instance,
level="OVERRIDABLE",
id="OUT_OF_DATE",
id="OUTDATED_CONVERT2RHEL_VERSION",
title="Outdated convert2rhel version detected",
description="An outdated convert2rhel version has been detected",
diagnosis=(
Expand Down Expand Up @@ -671,7 +671,7 @@ def test_convert2rhel_latest_bad_nevra_to_parse_pkg_string(
unit_tests.assert_actions_result(
convert2rhel_latest_action_instance,
level="OVERRIDABLE",
id="OUT_OF_DATE",
id="OUTDATED_CONVERT2RHEL_VERSION",
title="Outdated convert2rhel version detected",
description="An outdated convert2rhel version has been detected",
diagnosis=(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ def test_process_transaction_exceptions(self, pretend_os, caplog):

assert pkgmanager.Base.do_transaction.call_count == 1
assert "Failed to validate the dnf transaction." in caplog.records[-1].message
assert "FAILED_TO_VALIDATE_TRANSACTION" in execinfo._excinfo[1].id
assert "FAILED_TO_VALIDATE_DNF_TRANSACTION" in execinfo._excinfo[1].id
assert "Failed to validate dnf transaction." in execinfo._excinfo[1].title
assert (
"During the dnf transaction execution an error occured and convert2rhel could no longer process the transaction."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def test_process_transaction_with_exceptions(self, pretend_os, caplog, monkeypat
with pytest.raises(exceptions.CriticalError) as execinfo:
instance._process_transaction(validate_transaction=False)
assert "Failed to validate the yum transaction." in caplog.records[-1].message
assert "FAILED_TO_VALIDATE_TRANSACTION" in execinfo._excinfo[1].id
assert "FAILED_TO_VALIDATE_YUM_TRANSACTION" in execinfo._excinfo[1].id
assert "Failed to validate yum transaction." in execinfo._excinfo[1].title
assert (
"During the yum transaction execution an error occurred and convert2rhel could no longer process the transaction."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ tag+:
Mock newer version of convert2rhel
description+: |
Verify that running the newer than the latest GA version of convert2rhel
does not raise the CONVERT2RHEL_LATEST_VERSION.OUT_OF_DATE error.
does not raise the CONVERT2RHEL_LATEST_VERSION.OUTDATED_CONVERT2RHEL_VERSION error.
tag+:
- version-latest-or-newer
- sanity
Expand All @@ -80,7 +80,7 @@ tag+:
Older convert2rhel version without envar
description+: |
Verify that running an older version of convert2rhel without CONVERT2RHEL_ALLOW_OLDER_VERSION
environment variable in place, raises CONVERT2RHEL_LATEST_VERSION.OUT_OF_DATE error.
environment variable in place, raises CONVERT2RHEL_LATEST_VERSION.OUTDATED_CONVERT2RHEL_VERSION error.
tag+:
- version-older-no-envar
- inhibitor
Expand All @@ -92,7 +92,7 @@ tag+:
Older convert2rhel version with envar
description+: |
Verify that running an older version of convert2rhel with CONVERT2RHEL_ALLOW_OLDER_VERSION
environment variable in place, does not raise CONVERT2RHEL_LATEST_VERSION.OUT_OF_DATE.
environment variable in place, does not raise CONVERT2RHEL_LATEST_VERSION.OUTDATED_CONVERT2RHEL_VERSION.
environment+:
CONVERT2RHEL_ALLOW_OLDER_VERSION: 1
tag+:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def test_c2r_version_latest_inhibitor(convert2rhel, c2r_version, version):

assert (
c2r.expect_exact(
"(OVERRIDABLE) CONVERT2RHEL_LATEST_VERSION::OUT_OF_DATE - Outdated convert2rhel version detected",
"(OVERRIDABLE) CONVERT2RHEL_LATEST_VERSION::OUTDATED_CONVERT2RHEL_VERSION - Outdated convert2rhel version detected",
timeout=300,
)
== 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def test_transaction_validation_error(convert2rhel, shell, yum_cache):
c2r.expect("Pre-conversion analysis report", timeout=600)
c2r.expect("Must fix before conversion")
c2r.expect_exact(
"VALIDATE_PACKAGE_MANAGER_TRANSACTION::FAILED_TO_VALIDATE_TRANSACTION",
"VALIDATE_PACKAGE_MANAGER_TRANSACTION::FAILED_TO_VALIDATE_YUM_TRANSACTION",
timeout=600,
)

Expand Down
Loading