Improve handling of supervisor errors in ProcessManagingEventHandler

This commit is contained in:
Kristóf Tóth 2018-03-07 16:35:55 +01:00
parent 9b550f724d
commit 8588328a8f

View File

@ -38,11 +38,10 @@ class ProcessManagingEventHandler(TriggerlessEventHandler):
try: try:
data = data_json['data'] data = data_json['data']
self.processmanager(data['command'], data['process_name']) self.processmanager(data['command'], data['process_name'])
data_json['data']['error'] = False
return data_json return data_json
except KeyError: except KeyError:
log.error('IGNORING MESSAGE: Invalid data_json received: {}'.format(data_json)) log.error('IGNORING MESSAGE: Invalid data_json received: {}'.format(data_json))
except SupervisorFault: except SupervisorFault as fault:
data_json['data']['error'] = True data_json['data']['error'] = fault.faultString
log.debug('Failed to execute command on process: {}'.format(data_json)) log.debug('Failed to execute command on process: {}'.format(data_json))
return data_json return data_json