Agent: Catch exception when running plugins in master

This commit is contained in:
Shreya Malviya 2022-04-05 17:56:12 +05:30
parent c82a9cfbf0
commit 9495027678
1 changed files with 4 additions and 2 deletions

View File

@ -225,8 +225,10 @@ class AutomatedMaster(IMaster):
interrupted_message = f"Received a stop signal, skipping remaining {plugin_type}s"
for p in interruptible_iter(plugins, self._stop, interrupted_message):
# TODO: Catch exceptions to prevent thread from crashing
callback(p)
try:
callback(p)
except Exception as ex:
logger.debug(f"Exception encountered when running {plugin_type} {p}: {str(ex)}")
logger.info(f"Finished running {plugin_type}s")