|
48 | 48 | from repository import Repository
|
49 | 49 | from mercurial import MercurialRepository
|
50 | 50 | from repofactory import get_repository
|
51 |
| -from utils import is_exe, check_create_dir, get_int |
| 51 | +from utils import is_exe, check_create_dir, get_int, diff_list |
52 | 52 | from hook import run_hook
|
53 | 53 | from readconfig import read_config
|
54 | 54 | from opengrok import get_repos, get_config_value, get_repo_type
|
|
105 | 105 |
|
106 | 106 | GLOBAL_TUNABLES = ['hookdir', 'proxy', 'logdir', 'commands', 'projects',
|
107 | 107 | HOOK_TIMEOUT_PROPERTY, CMD_TIMEOUT_PROPERTY]
|
108 |
| - for key in config.keys(): |
109 |
| - if key not in GLOBAL_TUNABLES: |
110 |
| - logger.error("uknown global configuration option '{}'" |
111 |
| - .format(key)) |
112 |
| - sys.exit(1) |
| 108 | + diff = diff_list(config.keys(), GLOBAL_TUNABLES) |
| 109 | + if diff: |
| 110 | + logger.error("uknown global configuration option(s): '{}'" |
| 111 | + .format(diff)) |
| 112 | + sys.exit(1) |
113 | 113 |
|
114 | 114 | # Make sure the log directory exists.
|
115 | 115 | logdir = config.get("logdir")
|
|
181 | 181 | KNOWN_PROJECT_TUNABLES = ['disabled', CMD_TIMEOUT_PROPERTY,
|
182 | 182 | HOOK_TIMEOUT_PROPERTY, 'proxy',
|
183 | 183 | 'ignored_repos', 'hooks']
|
184 |
| - for key in project_config.keys(): |
185 |
| - if key not in KNOWN_PROJECT_TUNABLES: |
186 |
| - logger.error("uknown project configuration option '{}' " |
187 |
| - "for project {}".format(key, args.project)) |
188 |
| - sys.exit(1) |
| 184 | + diff = diff_list(project_config.keys(), KNOWN_PROJECT_TUNABLES) |
| 185 | + if diff: |
| 186 | + logger.error("uknown project configuration option(s) '{}' " |
| 187 | + "for project {}".format(diff, args.project)) |
| 188 | + sys.exit(1) |
189 | 189 |
|
190 | 190 | project_command_timeout = get_int(logger, "command timeout for "
|
191 | 191 | "project {}".format(args.project),
|
|
0 commit comments