Skip to content

Commit 9fd3311

Browse files
storing the prev_reboot_time.txt file under module-dir instead of module/history-dir so that there is not change required in sonic-host-services for #22072
1 parent 4ceeb7f commit 9fd3311

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sonic-chassisd/scripts/chassisd

+3-3
Original file line numberDiff line numberDiff line change
@@ -842,15 +842,15 @@ class SmartSwitchModuleUpdater(ModuleUpdater):
842842
def persist_dpu_reboot_time(self, module):
843843
"""Persist the current reboot time to a file."""
844844
time_str = self._get_current_time_str()
845-
path = self._get_history_path(module, "prev_reboot_time.txt")
845+
path = os.path.join(MODULE_REBOOT_CAUSE_DIR, module.lower(), "prev_reboot_time.txt")
846846

847847
os.makedirs(os.path.dirname(path), exist_ok=True)
848848
with open(path, 'w') as f:
849849
f.write(time_str)
850850

851851
def retrieve_dpu_reboot_time(self, module):
852852
"""Retrieve the persisted reboot time from a file."""
853-
path = self._get_history_path(module, "prev_reboot_time.txt")
853+
path = os.path.join(MODULE_REBOOT_CAUSE_DIR, module.lower(), "prev_reboot_time.txt")
854854

855855
try:
856856
with open(path, 'r') as f:
@@ -877,7 +877,7 @@ class SmartSwitchModuleUpdater(ModuleUpdater):
877877
prev_reboot_time = self._get_current_time_str()
878878

879879
file_name = f"{prev_reboot_time}_reboot_cause.json"
880-
prev_reboot_path = self._get_history_path(module, "prev_reboot_time.txt")
880+
prev_reboot_path = os.path.join(MODULE_REBOOT_CAUSE_DIR, module.lower(), "prev_reboot_time.txt")
881881

882882
if os.path.exists(prev_reboot_path):
883883
os.remove(prev_reboot_path)

0 commit comments

Comments
 (0)