[barefoot][platform] Chassis.get_reboot_cause (#7794)

To fix determine-reboot-cause service which was failing due to non-implemented thrown from get_reboot_case, if the reboot was done with `sudo reboot` (cold reboot)

Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com>
This commit is contained in:
Volodymyr Boiko 2021-06-11 23:30:03 +03:00 committed by GitHub
parent 4d07bbbec6
commit 3b451b7e12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -161,3 +161,16 @@ class Chassis(ChassisBase):
def get_change_event(self, timeout=0):
ready, event_sfp = Sfp.get_transceiver_change_event(timeout)
return ready, { 'sfp': event_sfp } if ready else {}
def get_reboot_cause(self):
"""
Retrieves the cause of the previous reboot
Returns:
A tuple (string, string) where the first element is a string
containing the cause of the previous reboot. This string must be
one of the predefined strings in this class. If the first string
is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used
to pass a description of the reboot cause.
"""
return self.REBOOT_CAUSE_NON_HARDWARE, ''