Skip to content

Commit 71b3793

Browse files
author
Vladimir Kotal
authored
check_project_configuration() should be more robust (#2933)
in the face of empty per project dictionary
1 parent ba5bb9f commit 71b3793

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

opengrok-tools/src/main/python/opengrok_tools/utils/mirror.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,17 @@ def check_project_configuration(multiple_project_config, hookdir=False,
376376
if not multiple_project_config:
377377
return True
378378

379+
logger.debug("Checking project configuration")
380+
379381
for project_name, project_config in multiple_project_config.items():
382+
logger.debug("Checking configuration of project {}".
383+
format(project_name))
384+
385+
if project_config is None:
386+
logger.warning("Project {} has empty configuration".
387+
format(project_name))
388+
continue
389+
380390
diff = set(project_config.keys()).difference(known_project_tunables)
381391
if diff:
382392
logger.error("unknown project configuration option(s) '{}' "

opengrok-tools/src/test/python/test_mirror.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,3 +169,7 @@ def mock_get(*args, **kwargs):
169169
m.setattr("opengrok_tools.utils.mirror.get", mock_get)
170170

171171
assert opengrok_tools.mirror.main() == CONTINUE_EXITVAL
172+
173+
174+
def test_empty_project_config():
175+
assert check_project_configuration({'foo': None})

0 commit comments

Comments
 (0)