From dce23d7eb43e078729f21791ef758174e530059a Mon Sep 17 00:00:00 2001 From: Sumit Jamgade Date: Fri, 10 May 2019 14:31:48 +0200 Subject: [PATCH] pass default_config_dirs variable for config initialization. Currently default config files are being for initialization of CONF from oslo_config. However default config dirs are not being passed as a result watcher components (eg: decision-engine) are unable to load files from default directories (eg: /etc/watcher/watcher.conf.d) supported by oslo_config. This is a short-coming on watcher's side. Also this forces user to have multiple config for each component. Without this default set, oslo_config will search for conf with string 'python-watcher' in it, eg: /etc/python-watcher/.... Since there is a because project=python-watcher a couple of lines below This patch adds the option after evaluating using project as 'watcher' which is similar to evaluation of default_config_files and also allows it to be passed in as a function parameter. Change-Id: I013f9d03978f8716847f8d1ee6888629faf5779b --- watcher/common/config.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/watcher/common/config.py b/watcher/common/config.py index 5ca04e3ff..967821843 100644 --- a/watcher/common/config.py +++ b/watcher/common/config.py @@ -21,12 +21,15 @@ from watcher.common import rpc from watcher import version -def parse_args(argv, default_config_files=None): +def parse_args(argv, default_config_files=None, default_config_dirs=None): default_config_files = (default_config_files or cfg.find_config_files(project='watcher')) + default_config_dirs = (default_config_dirs or + cfg.find_config_dirs(project='watcher')) rpc.set_defaults(control_exchange='watcher') cfg.CONF(argv[1:], project='python-watcher', version=version.version_info.release_string(), + default_config_dirs=default_config_dirs, default_config_files=default_config_files) rpc.init(cfg.CONF)