def prepare_capture(workflow): """ Prepare capture for the requested workflow. """ if app.config['mode'] not in ('scanner', 'full'): abort(404) # Check if any other workflow is active and finish, if neccessary logger.debug("Finishing previous workflows") for wfid, wf in persistence.get_all_workflows().iteritems(): if wf.active: if wfid == workflow.id and not 'reset' in request.args: return 'OK' wf.finish_capture() workflow.prepare_capture() return 'OK'
def list_workflows(): """ Return a list of all workflows. """ workflows = persistence.get_all_workflows() return make_response(json.dumps(workflows.values()), 200, {'Content-Type': 'application/json'})