Merge "Moved do_execute method to AuditHandler class"

This commit is contained in:
Zuul
2018-05-04 06:08:17 +00:00
committed by Gerrit Code Review
3 changed files with 9 additions and 10 deletions

View File

@@ -74,6 +74,13 @@ class AuditHandler(BaseAuditHandler):
def strategy_context(self): def strategy_context(self):
return self._strategy_context return self._strategy_context
def do_execute(self, audit, request_context):
# execute the strategy
solution = self.strategy_context.execute_strategy(
audit, request_context)
return solution
def do_schedule(self, request_context, audit, solution): def do_schedule(self, request_context, audit, solution):
try: try:
notifications.audit.send_action_notification( notifications.audit.send_action_notification(

View File

@@ -71,9 +71,8 @@ class ContinuousAuditHandler(base.AuditHandler):
return False return False
def do_execute(self, audit, request_context): def do_execute(self, audit, request_context):
# execute the strategy solution = super(ContinuousAuditHandler, self)\
solution = self.strategy_context.execute_strategy( .do_execute(audit, request_context)
audit, request_context)
if audit.audit_type == objects.audit.AuditType.CONTINUOUS.value: if audit.audit_type == objects.audit.AuditType.CONTINUOUS.value:
a_plan_filters = {'audit_uuid': audit.uuid, a_plan_filters = {'audit_uuid': audit.uuid,

View File

@@ -20,13 +20,6 @@ from watcher import objects
class OneShotAuditHandler(base.AuditHandler): class OneShotAuditHandler(base.AuditHandler):
def do_execute(self, audit, request_context):
# execute the strategy
solution = self.strategy_context.execute_strategy(
audit, request_context)
return solution
def post_execute(self, audit, solution, request_context): def post_execute(self, audit, solution, request_context):
super(OneShotAuditHandler, self).post_execute(audit, solution, super(OneShotAuditHandler, self).post_execute(audit, solution,
request_context) request_context)