From 47c3dc23529e43bba509171f6addd449e0cb5622 Mon Sep 17 00:00:00 2001 From: wilfriedroset Date: Thu, 27 Jun 2019 14:58:07 +0200 Subject: [PATCH] patronictl checks if --config value exists (#736) (#1092) Be verbose about configuration file when the given filename does not exists instead of ignoring silently (which can lead to misunderstanding) --- patroni/ctl.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/patroni/ctl.py b/patroni/ctl.py index e104988e..7fc4c23a 100644 --- a/patroni/ctl.py +++ b/patroni/ctl.py @@ -69,7 +69,10 @@ def parse_dcs(dcs): def load_config(path, dcs): - logging.debug('Loading configuration from file %s', path) + if not (os.path.exists(path) and os.access(path, os.R_OK)): + logging.debug('Ignoring configuration file "%s". It does not exists or is not readable.', path) + else: + logging.debug('Loading configuration from file %s', path) config = {} old_argv = list(sys.argv) try: