config = {} GLOBAL_TUNABLES = [ HOOKDIR_PROPERTY, PROXY_PROPERTY, LOGDIR_PROPERTY, COMMANDS_PROPERTY, PROJECTS_PROPERTY, HOOK_TIMEOUT_PROPERTY, CMD_TIMEOUT_PROPERTY ] diff = diff_list(config.keys(), GLOBAL_TUNABLES) if diff: logger.error( "unknown global configuration option(s): '{}'".format(diff)) sys.exit(1) # Make sure the log directory exists. logdir = config.get(LOGDIR_PROPERTY) if logdir: check_create_dir(logger, logdir) uri = args.uri if not uri: logger.error("uri of the webapp not specified") sys.exit(1) logger.debug("Uri = {}".format(uri)) source_root = get_config_value(logger, 'sourceRoot', uri) if not source_root: logger.error("Cannot get the sourceRoot config value") sys.exit(1) logger.debug("Source root = {}".format(source_root))
logging.basicConfig() logger = logging.getLogger(os.path.basename(sys.argv[0])) if args.config: config = read_config(logger, args.config) if config is None: logger.error("Cannot read config file from {}".format(args.config)) sys.exit(1) else: config = {} # Make sure the log directory exists. logdir = config.get("logdir") if logdir: check_create_dir(logdir) if args.messages: messages_file = which(args.messages) if not messages_file: logger.error("file {} does not exist".format(args.messages)) sys.exit(1) else: messages_file = which("Messages") if not messages_file: logger.error("cannot determine path to Messages") sys.exit(1) logger.debug("Messages = {}".format(messages_file)) source_root = get_config_value(logger, 'sourceRoot', messages_file) if not source_root:
logger = logging.getLogger(os.path.basename(sys.argv[0])) config = read_config(logger, args.config) if config is None: logger.error("Cannot read config file from {}".format(args.config)) sys.exit(1) # Make sure the log directory exists. try: logdir = config["logdir"] except: logger.error("'logdir' does not exist in configuration") sys.exit(1) else: check_create_dir(logdir) if args.messages: messages_file = which(args.messages) if not messages_file: logger.error("file {} does not exist".format(args.messages)) sys.exit(1) else: messages_file = which("Messages") if not messages_file: logger.error("cannot determine path to Messages") sys.exit(1) logger.debug("Messages = {}".format(messages_file)) source_root = get_config_value(logger, 'sourceRoot', messages_file) if not source_root: