Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[reboot-cause] Porting PR to fix a broken symlink of previous-reboot-…
…cause file removal issue (sonic-host-services #46) (sonic-net#14106) Why I did it Porting/cherry-pick PR sonic-net/sonic-host-services#46 "show reboot-cause history" shows empty history. When the previous-reboot-cause has a broken symlink, And rebooting the system will not be able to generate a new symlink of the new previous-reboot-cause. admin@sonic:~$ show reboot-cause history Name Cause Time User Comment ------ ------- ------ ------ --------- How I did it Somehow, when the symlink file /host/reboot-cause/previous-reboot-cause is broken (which its destination files doesn't exist in this case), the current condition check "if os.path,exists(PREVIOUS_REBOOT_CAUSE_FILE)" will return False in determine-reboot-cause script. Hence, the current previous-reboot-cause is not been removed and the recreation of the new previous-reboot-cause failed. In case of previous-reboot-cause is a broken synlink file, add condition os.path.islink(PREVIOUS_REBOOT_CAUSE) to check and allow the remove operation happens. How to verify it Manually make the /host/reboot-cause/previous-reboot-cause to be a broken symlink file by removing its destination file reboot the system. "show reboot-cause history" should show the correct info Signed-off-by: mlok <marty.lok@nokia.com>
- Loading branch information