fix restore triggers error

The 'add_trigger' function may raise exception when initializing a trigger,
it will cause the operationengine service always quit, we need to catch it to avaid that.

Change-Id: I468956c180d3a1ca5ece6b6ca58ade612f6fa5ad
This commit is contained in:
fudunwei 2020-12-09 13:46:22 +08:00
parent fcca3935af
commit 43f063ea84
1 changed files with 9 additions and 2 deletions

View File

@ -114,8 +114,15 @@ class OperationEngineManager(manager.Manager):
break
for trigger in triggers:
self.trigger_manager.add_trigger(trigger.id, trigger.type,
trigger.properties)
try:
self.trigger_manager.add_trigger(trigger.id, trigger.type,
trigger.properties)
except Exception as e:
LOG.error('Add trigger (id: "%s" type: "%s" properties: '
'"%s") to manager error, reason: %s',
trigger.id, trigger.type, trigger.properties,
str(e))
if len(triggers) < limit:
break
marker = triggers[-1].id