Catch exceptions from worker controller.

Surprise exceptions can get hidden by the Gearman stuff. Catch them
here and report failure.

Change-Id: I7fab24d809f8e91bc68c45296f369011e4d5c30d
This commit is contained in:
David Shrewsbury
2012-11-06 11:17:33 -05:00
parent 7fd7e6e37a
commit 0823ef6b3f

View File

@@ -45,6 +45,8 @@ class LBaaSController(object):
action = self.msg[self.ACTION_FIELD].upper()
self.logger.info("Requested action: %s" % action)
try:
if action == 'CREATE':
return self._action_create()
elif action == 'UPDATE':
@@ -60,6 +62,11 @@ class LBaaSController(object):
(self.ACTION_FIELD, action))
self.msg[self.RESPONSE_FIELD] = self.RESPONSE_FAILURE
return self.msg
except Exception as e:
self.logger.error("Controller exception: %s, %s" %
(e.__class__, e))
self.msg[self.RESPONSE_FIELD] = self.RESPONSE_FAILURE
return self.msg
def _action_create(self):
"""