diff options
author | Erik Johnston <erik@matrix.org> | 2015-08-25 17:08:23 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-08-25 17:08:23 +0100 |
commit | 3e1029fe8050edd8f6aed57bdf6507a12ffb0a0c (patch) | |
tree | ed32edeb86c277e1948015e5881cdcf1101c3d28 | |
parent | Allow specifying directories as config files (diff) | |
download | synapse-3e1029fe8050edd8f6aed57bdf6507a12ffb0a0c.tar.xz |
Warn if we encounter unexpected files in config directories
-rw-r--r-- | synapse/config/_base.py | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/synapse/config/_base.py b/synapse/config/_base.py index fd5080a3cb..2f218d4a7b 100644 --- a/synapse/config/_base.py +++ b/synapse/config/_base.py @@ -159,13 +159,23 @@ class Config(object): # We accept specifying directories as config paths, we search # inside that directory for all files matching *.yaml, and then # we apply them in *sorted* order. - config_files.extend(sorted( - os.path.join(config_path, entry) - for entry in os.listdir(config_path) - if entry.endswith(".yaml") and os.path.isfile( - os.path.join(config_path, entry) - ) - )) + files = [] + for entry in os.listdir(config_path): + entry_path = os.path.join(config_path, entry) + if not os.path.isfile(entry_path): + print ( + "Found subdirectory in config directory: %r. IGNORING." + ) % (entry_path, ) + continue + + if not entry.endswith(".yaml"): + print ( + "Found file in config directory that does not" + " end in '.yaml': %r. IGNORING." + ) % (entry_path, ) + continue + + config_files.extend(sorted(files)) else: config_files.append(config_path) |