Exemplo n.º 1
0
def run(config):
    print "command stop: %s" % config
    if config["uuid"] and config["agent"]:
        raise ValueError("Can't stop both a task and a tracer")
    elif config["agent"]:
        agents = _parse_agents_from_args(config)
        agent_api.stop_tracers(agents)
    else:
        # no tracers are specified so trying to find a task
        task = agent_api.try_get_task_from_config(config)
        agent_api.stop_task(task["uuid"])
Exemplo n.º 2
0
def run(config):
    if config["uuid"] and config["agent"]:
        raise ValueError("Can't stop both a task and a tracer")
    elif config["agent"]:
        req_tr = _parse_agents_from_args(config)
        all_tr = {t["name"]: t for t in agent_api.get_tracer_list()}
        for tr in req_tr:
            for ret_uuid in all_tr[tr]["results"]:
                ret = agent_api.get_result(ret_uuid)
                utils.pprint_result(ret)
    else:

        task = agent_api.try_get_task_from_config(config)

        print "reporting task: <%s>" % task["uuid"]
        rets = []
        for ret_uuid in task["results"]:
            ret = agent_api.get_result(ret_uuid)
            rets.append(ret)
        if config.get("html"):
            utils.generate_multiple_result_html(rets)
        else:
            map(utils.pprint_result, rets)