Skip to content

Commit 1242953

Browse files
Vladimir Kotalahornace
authored andcommitted
fix get_bool()
1 parent 2138504 commit 1242953

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ def get_project_properties(project_config, project_name, hookdir):
215215
logger.debug("will use proxy")
216216
use_proxy = True
217217

218-
if project_config.get(INCOMING_PROPERTY):
218+
if project_config.get(INCOMING_PROPERTY) is not None:
219219
check_changes = get_bool(logger, ("incoming check for project {}".
220220
format(project_name)),
221221
project_config.get(INCOMING_PROPERTY))
@@ -264,6 +264,8 @@ def process_changes(repos, project_name, uri, headers=None):
264264

265265
changes_detected = False
266266

267+
logger.debug("Checking incoming changes for project {}".format(project_name))
268+
267269
# check if the project is a new project - full index is necessary
268270
try:
269271
r = do_api_call('GET', get_uri(uri, 'api', 'v1', 'projects',

tools/src/main/python/opengrok_tools/utils/utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,15 @@ def get_int(logger, name, value):
100100

101101
def get_bool(logger, name, value):
102102
"""
103-
If the supplied value is bool, return it. Otherwise return None.
103+
If the supplied value is bool or its representation, return the bool value.
104+
Otherwise return None.
104105
"""
105106
if value is None:
106107
return None
107108

109+
if type(value) is bool:
110+
return value
111+
108112
try:
109113
return bool(util.strtobool(value))
110114
except ValueError:

0 commit comments

Comments
 (0)