def do_main(args): """Execute according to subcommands""" # Set up environment if not args.quiet: # set up console logs global logger global console logger.addHandler(console) logger.debug("Starting...") prep.setup(args.working_dir) if args.clear_cache: logger.debug('Clearing cache...') cache.clear() if args.sub == 'lock': drun.execute_dockerfile(args, True) elif args.sub == 'report': if args.dockerfile: if (not args.load_until_layer): drun.execute_dockerfile(args) else: logger.critical("Currently --layer/-y can only be used with" " --docker-image/-i") sys.exit(1) elif args.docker_image or args.raw_image: check_image_input(args) # If the checks are OK, execute for docker image crun.execute_image(args) elif args.sub == 'debug': derun.execute_debug(args) # Tear down the environment prep.teardown(args.keep_wd) logger.debug('Finished')
def do_main(args): """Execute according to subcommands""" # Set up environment if not args.quiet: # set up console logs global logger global console logger.addHandler(console) logger.debug("Starting...") prep.setup(args.working_dir) if args.clear_cache: logger.debug('Clearing cache...') cache.clear() if hasattr(args, 'name'): if args.name == 'lock': drun.execute_dockerfile(args, True) elif args.name == 'report': if args.dockerfile: drun.execute_dockerfile(args) elif args.docker_image: # Check if the image string is a tarball if general.check_tar(args.docker_image): logger.critical(errors.incorrect_raw_option) sys.exit(1) # Check if the image string has the right format if not check_image_string(args.docker_image): logger.critical(errors.incorrect_image_string_format) sys.exit(1) # If the checks are OK, execute for docker image crun.execute_image(args) # Tear down the environment prep.teardown(args.keep_wd) logger.debug('Finished')
def do_main(args): """Execute according to subcommands""" # Set up environment global logger global formatter # set up file log if args.log_file: log_handler = logging.FileHandler(args.log_file, mode='w') else: log_handler = logging.FileHandler(constants.logfile, mode='w') log_handler.setLevel(logging.DEBUG) log_handler.setFormatter(formatter) logger.addHandler(log_handler) if not args.quiet: # set up console logs console = logging.StreamHandler() console.setLevel(logging.DEBUG) console.setFormatter(formatter) logger.addHandler(console) logger.debug("Starting...") prep.setup(args.working_dir) if args.clear_cache: logger.debug('Clearing cache...') cache.clear() if args.sub == 'lock': drun.execute_dockerfile(args, True) elif args.sub == 'report': if args.dockerfile: if (not args.load_until_layer): drun.execute_dockerfile(args) else: logger.critical("Currently --layer/-y can only be used with" " --image/-i") sys.exit(1) elif args.image or args.raw_image: check_image_input(args) # If the checks are OK, execute for docker image crun.execute_image(args) elif args.live: lrun.execute_live(args) elif args.sub == 'debug': derun.execute_debug(args) # Tear down the environment prep.teardown(args.keep_wd) logger.debug('Finished')