[reboot-cause] Fixed determine-reboot-cause.service failure. (#8210)

Signed-off-by: Rajkumar Pennadam Ramamoorthy rpennadamram@marvell.com

Why I did it
Install sonic image from ONIE. Once system is up, execute "config reload" command.

Root cause is that "determine-reboot-cause.service" was in failed state.
root@sonic:/host/reboot-cause# systemctl list-units --failed
UNIT LOAD ACTIVE SUB DESCRIPTION
● determine-reboot-cause.service loaded failed failed Reboot cause determination service

How I did it
Fixed the issue by setting default reason to "REBOOT_CAUSE_UNKNOWN" instead of "None".

How to verify it
Check " determine-reboot-cause.service' loaded successfully post image installation from ONIE.
Verify "reboot-cause.txt" file is created and config reload succeeds.
This commit is contained in:
Rajkumar-Marvell 2021-08-10 23:52:09 +05:30 committed by GitHub
parent 14da7a1663
commit d6433d1adc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -62,7 +62,7 @@ def parse_warmfast_reboot_from_proc_cmdline():
def find_software_reboot_cause_from_reboot_cause_file():
software_reboot_cause = None
software_reboot_cause = REBOOT_CAUSE_UNKNOWN
if os.path.isfile(REBOOT_CAUSE_FILE):
with open(REBOOT_CAUSE_FILE) as cause_file:
software_reboot_cause = cause_file.readline().rstrip('\n')