diff --git a/routerstats_client.py b/routerstats_client.py index ae2d240..b5e61c2 100755 --- a/routerstats_client.py +++ b/routerstats_client.py @@ -324,6 +324,7 @@ def main(): logging.debug('Starting as PID %s', os.getpid()) found = False + config_dirs = ('/etc/routerstats/', '/usr/local/etc/routerstats/', '/opt/routerstats/', './') if args.config: if os.path.isfile(args.config): config.read(args.config) @@ -333,14 +334,14 @@ def main(): else: logging.debug('Trying to find config') #Try to find in "usual" places - for directory in ('/etc/routerstats/', '/usr/local/etc/routerstats/', '/opt/routerstats/', './'): + for directory in config_dirs: trytoread = directory + 'routerstats.config' if os.path.isfile(trytoread): logging.debug('Reading config file %s', trytoread) config.read(trytoread) found = True if not found: - logging.error('No config file found') + logging.error('routerstats.config not found in %s', config_dirs) sys.exit(0) parser.add_argument( diff --git a/routerstats_collector.py b/routerstats_collector.py index 7df79b0..9ff4904 100755 --- a/routerstats_collector.py +++ b/routerstats_collector.py @@ -450,6 +450,7 @@ def main(): logging.debug('Starting as PID %s' ,os.getpid()) found = False + config_dirs = ('/etc/routerstats/', '/usr/local/etc/routerstats/', '/opt/routerstats/', './') if args.config: if os.path.isfile(args.config): config.read(args.config) @@ -459,14 +460,14 @@ def main(): else: logging.debug('Trying to find config') #Try to find in "usual" places - for directory in ('/etc/routerstats/', '/usr/local/etc/routerstats/', '/opt/routerstats/', './'): + for directory in config_dirs: trytoread = directory + 'routerstats.config' if os.path.isfile(trytoread): logging.debug('Reading config file %s', trytoread) config.read(trytoread) found = True if not found: - logging.error('No config file found') + logging.error('routerstats.config not found in %s', config_dirs) sys.exit(0) parser.add_argument( diff --git a/routerstats_httpd.py b/routerstats_httpd.py index 384ff38..5d47b2e 100755 --- a/routerstats_httpd.py +++ b/routerstats_httpd.py @@ -136,6 +136,7 @@ def main(): logging.debug('Starting as PID %s', os.getpid()) found = False + config_dirs = ('/etc/routerstats/', '/usr/local/etc/routerstats/', '/opt/routerstats/', './') if args.config: if os.path.isfile(args.config): config.read(args.config) @@ -145,14 +146,14 @@ def main(): else: logging.debug('Trying to find config') #Try to find in "usual" places - for directory in ('/etc/routerstats/', '/usr/local/etc/routerstats/', '/opt/routerstats/', './'): + for directory in config_dirs: trytoread = directory + 'routerstats.config' if os.path.isfile(trytoread): logging.debug('Reading config file %s', trytoread) config.read(trytoread) found = True if not found: - logging.error('No config file found') + logging.error('routerstats.config not found in %s', config_dirs) sys.exit(0) parser.add_argument(