Skip to content

Commit

Permalink
[syseepromd] Prevent the syseepromd from termination (sonic-net#56)
Browse files Browse the repository at this point in the history
Since the termination of the syseepromd will lead to the termination of the pmon.
Regularly try to update the eeprom data, instead of exiting the syseepromd directly when the update_eeprom_to_db return with failure.
  • Loading branch information
kuanyu99 authored May 21, 2020
1 parent 6e975f5 commit 5b14368
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions sonic-syseepromd/scripts/syseepromd
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,13 @@ class DaemonSyseeprom(DaemonBase):
if self.eeprom is not None:
try:
return self.eeprom.read_eeprom()
except NotImplementedError:
except (NotImplementedError, IOError):
pass

return self.eeprom.read_eeprom()
try:
return self.eeprom.read_eeprom()
except IOError:
pass

def _wrapper_update_eeprom_db(self, eeprom):
if self.eeprom is not None:
Expand Down Expand Up @@ -136,7 +139,7 @@ class DaemonSyseeprom(DaemonBase):
# Connect to STATE_DB and post syseeprom info to state DB
rc = self.post_eeprom_to_db()
if rc != POST_EEPROM_SUCCESS:
return rc
logger.log_error("Failed to post eeprom to database")

# Start main loop
logger.log_info("Start daemon main loop")
Expand All @@ -148,7 +151,8 @@ class DaemonSyseeprom(DaemonBase):
self.clear_db()
rcs = self.post_eeprom_to_db()
if rcs != POST_EEPROM_SUCCESS:
self.stop_event.set()
logger.log_error("Failed to post eeprom to database")
continue

logger.log_info("Stop daemon main loop")

Expand Down

0 comments on commit 5b14368

Please sign in to comment.