Skip to content

Commit

Permalink
Adding error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
rameshraghupathy committed Oct 30, 2024
1 parent 153962b commit 465bf31
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sonic-chassisd/scripts/chassisd
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,10 @@ class SmartSwitchModuleUpdater(ModuleUpdater):
"""Rotate history files if they exceed the maximum limit."""
history_dir = os.path.join(REBOOT_CAUSE_DIR, module.lower(), "history")
os.makedirs(history_dir, exist_ok=True)
files = sorted(os.listdir(history_dir))
try:
files = sorted(os.listdir(history_dir))
except FileNotFoundError:
return

if not files:
return
Expand Down

0 comments on commit 465bf31

Please sign in to comment.