Ejemplo n.º 1
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)
Ejemplo n.º 2
0
def run(config):
    """Run Command

    uuid: pprint it
    list: pprint all
    uuid and html: generate_result_html
    list and html: generate_multiple_result_html
    """
    if config.get("list"):
        rets = agent_api.get_all_results()
        if config.get("html"):
            utils.generate_multiple_result_html(rets)
        elif config.get("short"):
            for ret in rets:
                print ret["uuid"]
        else:
            map(utils.pprint_result, rets)
    elif config.get("uuid"):
        ret = agent_api.get_result(config["uuid"])
        if config.get("html"):
            utils.generate_result_html(ret)
        else:
            utils.pprint_result(ret)