Skip to content

Commit

Permalink
make error message more specific
Browse files Browse the repository at this point in the history
  • Loading branch information
BYGX-wcr committed Feb 10, 2025
1 parent 838af4a commit 676c189
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion scripts/determine-reboot-cause
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def get_reboot_cause_from_platform():
hardware_reboot_cause_major, hardware_reboot_cause_minor = REBOOT_CAUSE_NON_HARDWARE, "N/A"
except (NotImplementedError):
sonic_logger.log_warning("sonic_platform package not implemented. Unable to detect hardware reboot causes.")
hardware_reboot_cause_major, hardware_reboot_cause_minor = REBOOT_CAUSE_NON_HARDWARE, "N/A"
hardware_reboot_cause_major, hardware_reboot_cause_minor = REBOOT_CAUSE_NON_HARDWARE, "Platform pkg not implemented"

return hardware_reboot_cause_major, hardware_reboot_cause_minor

Expand Down
4 changes: 2 additions & 2 deletions tests/determine-reboot-cause_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def test_find_hardware_reboot_cause_with_minor(self):

def test_find_hardware_reboot_cause_not_implemented(self):
result = determine_reboot_cause.find_hardware_reboot_cause()
assert result == REBOOT_CAUSE_NON_HARDWARE + " (N/A)"
assert result == REBOOT_CAUSE_NON_HARDWARE + " (Platform pkg not implemented)"

def test_get_reboot_cause_dict_watchdog(self):
reboot_cause_dict = determine_reboot_cause.get_reboot_cause_dict(REBOOT_CAUSE_WATCHDOG, "", GEN_TIME_WATCHDOG)
Expand Down Expand Up @@ -214,7 +214,7 @@ def test_determine_reboot_cause_main_with_reboot_cause_dir(self):
with mock.patch("os.geteuid", return_value=0):
determine_reboot_cause.main()
assert os.path.exists("host/reboot-cause/reboot-cause.txt") == True
assert os.path.exists("host/reboot-cause/previous-reboot-cause.json") == True
assert os.path.exists("host/reboot-cause/previous-reboot-cause.json") == True

def create_mock_platform_json(self, dpus):
"""Helper function to create a mock platform.json file."""
Expand Down

0 comments on commit 676c189

Please sign in to comment.