Beispiel #1
0
def inserter_control(network):
    """
    POST control route for inserter forms
    """
    inserter_form = ProcessControlForm(request.form)
    task = None

    # On form submit controls the processor
    if request.method == 'POST' and inserter_form.validate():
        command = request.form['control'].lower()

        task_args = {
            'process': 'insert',
            'project': g.project,
            'network': network
        }

        if command == 'start':
            task = start_daemon.apply_async(kwargs=task_args,
                                            queue='stack-start')
        elif command == 'stop':
            task = stop_daemon.apply_async(kwargs=task_args,
                                           queue='stack-stop')
        elif command == 'restart':
            task = restart_daemon.apply_async(kwargs=task_args,
                                              queue='stack-start')

    return redirect(
        url_for('network_home',
                project_name=g.project['project_name'],
                network=network,
                inserter_task_id=task.task_id))
Beispiel #2
0
def inserter_control(network):
    """
    POST control route for inserter forms
    """
    inserter_form = ProcessControlForm(request.form)
    task = None

    # On form submit controls the processor
    if request.method == 'POST' and inserter_form.validate():
        command = request.form['control'].lower()

        task_args = {
            'process': 'insert',
            'project': g.project,
            'network': network
        }

        if command == 'start':
            task = start_daemon.apply_async(kwargs=task_args, queue='stack-start')
        elif command == 'stop':
            task = stop_daemon.apply_async(kwargs=task_args, queue='stack-stop')
        elif command == 'restart':
            task = restart_daemon.apply_async(kwargs=task_args, queue='stack-start')

    return redirect(url_for('network_home',
                            project_name=g.project['project_name'],
                            network=network,
                            inserter_task_id=task.task_id))
Beispiel #3
0
def collector_control(collector_id):
    """
    POST control route for collector forms
    """
    collector_form = ProcessControlForm(request.form)
    task = None

    # On form submit controls the processor
    if request.method == 'POST' and collector_form.validate():
        command = request.form['control'].lower()

        task_args = {
            'process': 'collect',
            'project': g.project,
            'collector_id': collector_id
        }

        db = DB()
        collector = db.get_collector_detail(g.project['project_id'], collector_id)
        network = collector['collector']['network']

        if command == 'start':
            task = start_daemon.apply_async(kwargs=task_args, queue='stack-start')
        elif command == 'stop':
            task = stop_daemon.apply_async(kwargs=task_args, queue='stack-stop')
        elif command == 'restart':
            task = restart_daemon.apply_async(kwargs=task_args, queue='stack-start')

        return redirect(url_for('collector',
                                project_name=g.project['project_name'],
                                network=network,
                                collector_id=collector_id,
                                task_id=task.task_id))
Beispiel #4
0
def collector_control(collector_id):
    """
    POST control route for collector forms
    """
    collector_form = ProcessControlForm(request.form)
    task = None

    # On form submit controls the processor
    if request.method == 'POST' and collector_form.validate():
        command = request.form['control'].lower()

        task_args = {
            'process': 'collect',
            'project': g.project,
            'collector_id': collector_id
        }

        db = DB()
        collector = db.get_collector_detail(g.project['project_id'],
                                            collector_id)
        network = collector['collector']['network']

        if command == 'start':
            task = start_daemon.apply_async(kwargs=task_args,
                                            queue='stack-start')
        elif command == 'stop':
            task = stop_daemon.apply_async(kwargs=task_args,
                                           queue='stack-stop')
        elif command == 'restart':
            task = restart_daemon.apply_async(kwargs=task_args,
                                              queue='stack-start')

        return redirect(
            url_for('collector',
                    project_name=g.project['project_name'],
                    network=network,
                    collector_id=collector_id,
                    task_id=task.task_id))