Ejemplo n.º 1
0
 def from_plan(cls, planfile, config='config'):
     plan = Plan.from_file(planfile)
     pp = PlanProcessor(plan, config)
     return pp.process_plan()
Ejemplo n.º 2
0
    console_handler = logging.StreamHandler(sys.stderr)
    console_handler.setFormatter(logging.Formatter())
    console_handler.setLevel(logging.INFO)
    root_logger = logging.getLogger()
    root_logger.addHandler(console_handler)
    root_logger.setLevel(logging.DEBUG)

if __name__ == "__main__":
    setup_logging()
    args = docopt(__doc__)

    if args["load"]:
        with open(args["<filename>"], 'r') as f:
            pprint.pprint(load(f))
    elif args["parse"]:
        plan = Plan.from_file(args["<filename>"])
        print plan
    elif args["process"]:
        assembly = Assembly.from_plan(args["<filename>"])
        print assembly

    elif args["generate"]:
        assembly = Assembly.from_plan(args["<filename>"])
        assembly.generate_files(os.path.split(args["<filename>"])[0], args["<output_folder>"])
    elif args["generun"]:
        assembly = Assembly.from_plan(args["<filename>"])
        assembly.generate_files(os.path.split(args["<filename>"])[0], args["<output_folder>"])
        os.chdir(os.path.join(args["<output_folder>"], assembly.plan.name))
        client = Client(docker_url())
        assembly.run(client)
    elif args["start"]: