Ejemplo n.º 1
0
    def load_procedures(self):
        if os.path.exists("AVMaster/conf/procedures.yaml"):
            Procedure.load_from_file("AVMaster/conf/procedures.yaml")

        confs = glob.glob("AVMaster/conf/procedures/*.yaml")
        for conf in confs:
            logging.info("Loading conf: %s" % conf)
            Procedure.load_from_file(conf)
        if not Procedure.check():
            raise SyntaxError("Errors in procedures")
Ejemplo n.º 2
0
def test_procedure_file():
    procedures = Procedure.load_from_file("../AVMaster/conf/procedures/procedures.yaml")
    assert procedures, "empty procedures"
    logging.debug("procedures: %s" % procedures)
    for p in procedures.values():
        assert isinstance(p, Procedure), "not a Procedure: %s" % p
Ejemplo n.º 3
0
    parser.add_argument('-f', '--force', action='store_true', default=False,
                        help="force ")

    args = parser.parse_args()

    report = time.strftime("%y%m%d", time.localtime(time.time()))

    logger.init(".", "avagent.log")
    from AVCommon.logger import logging
    globals()['logging']=logging

    logging.debug(args)

    mq = None
    procedure = None
    if args.procedure and args.procedure_file:
        logging.info("Procedure %s" % args.procedure)
        logging.debug("pwd: %s" % os.getcwd())
        path = os.getcwd()
        procs = Procedure.load_from_file(args.procedure_file)
        logging.debug("%s" % procs)
        procedure = procs[args.procedure]
        mq = MQFeedProcedure()
    Procedure.check()

    try:
        avagent = AVAgent(args.vm, args.redis, args.session)
        avagent.start_agent(mq, procedure, force=args.force)
    except:
        logging.exception("FATAL")