Skip to content

Commit

Permalink
Merge pull request #2418 from nsoranzo/toolbox_watcher
Browse files Browse the repository at this point in the history
Raise Exception if watch_tools has an unrecognized value
  • Loading branch information
jmchilton committed May 26, 2016
2 parents 27b70ca + 4bfcce0 commit 4eeb73e
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions lib/galaxy/tools/toolbox/watcher.py
Expand Up @@ -23,19 +23,23 @@ def get_observer_class(config_value, default, monitor_what_str):
config_value = config_value or default
config_value = str(config_value).lower()
if config_value in ("true", "yes", "on", "auto"):
expect_observer = config_value != "auto"
expect_observer = True
observer_class = Observer
elif config_value == "polling":
expect_observer = True
observer_class = PollingObserver
else:
elif config_value in ('false', 'no', 'off'):
expect_observer = False
observer_class = None

if observer_class is None:
message = "Watchdog library unavailble, cannot monitor %s." % monitor_what_str
log.info(message)
if expect_observer:
else:
message = "Unrecognized value for watch_tools config option: %s" % config_value
raise Exception(message)

if expect_observer and observer_class is None:
message = "Watchdog library unavailable, cannot monitor %s." % monitor_what_str
if config_value == "auto":
log.info(message)
else:
raise Exception(message)

return observer_class
Expand Down

0 comments on commit 4eeb73e

Please sign in to comment.