@@ -52,12 +52,16 @@ def read_reboot_cause_files_and_save_state_db():
52
52
x = TIME_SORTED_FULL_REBOOT_FILE_LIST [i ]
53
53
if os .path .isfile (x ):
54
54
with open (x , "r" ) as cause_file :
55
- data = json .load (cause_file )
56
- _hash = '{}|{}' .format (REBOOT_CAUSE_TABLE_NAME , data ['gen_time' ])
57
- state_db .set (state_db .STATE_DB , _hash , 'cause' , data ['cause' ])
58
- state_db .set (state_db .STATE_DB , _hash , 'time' , data ['time' ])
59
- state_db .set (state_db .STATE_DB , _hash , 'user' , data ['user' ])
60
- state_db .set (state_db .STATE_DB , _hash , 'comment' , data ['comment' ])
55
+ try :
56
+ data = json .load (cause_file )
57
+ _hash = '{}|{}' .format (REBOOT_CAUSE_TABLE_NAME , data ['gen_time' ])
58
+ state_db .set (state_db .STATE_DB , _hash , 'cause' , data ['cause' ])
59
+ state_db .set (state_db .STATE_DB , _hash , 'time' , data ['time' ])
60
+ state_db .set (state_db .STATE_DB , _hash , 'user' , data ['user' ])
61
+ state_db .set (state_db .STATE_DB , _hash , 'comment' , data ['comment' ])
62
+ except json .decoder .JSONDecodeError as je :
63
+ sonic_logger .log_info ("Unable to process reload cause file {}: {}" .format (x , je ))
64
+ pass
61
65
62
66
if len (TIME_SORTED_FULL_REBOOT_FILE_LIST ) > 10 :
63
67
for i in range (len (TIME_SORTED_FULL_REBOOT_FILE_LIST )):
0 commit comments