diff --git a/lower-constraints.txt b/lower-constraints.txt index 0dbb17383..c5cf99278 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -77,7 +77,7 @@ os-xenapi==0.3.3 osc-lib==1.10.0 oslo.cache==1.26.0 oslo.concurrency==3.26.0 -oslo.config==6.1.0 +oslo.config==6.7.0 oslo.context==2.19.2 oslo.db==4.40.0 oslo.i18n==3.15.3 diff --git a/placement/wsgi.py b/placement/wsgi.py index 4ad356122..56afbd120 100644 --- a/placement/wsgi.py +++ b/placement/wsgi.py @@ -51,12 +51,20 @@ def setup_logging(config): py_logging.captureWarnings(True) -def _get_config_file(env=None): +def _get_config_files(env=None): + """Return a list of one file or None describing config location. + + If None, that means oslo.config will look in the default locations + for a config file. + """ if env is None: env = os.environ - dirname = env.get('OS_PLACEMENT_CONFIG_DIR', '/etc/placement').strip() - return os.path.join(dirname, CONFIG_FILE) + dirname = env.get('OS_PLACEMENT_CONFIG_DIR', '').strip() + if dirname: + return [os.path.join(dirname, CONFIG_FILE)] + else: + return None def _parse_args(argv, default_config_files): @@ -100,19 +108,17 @@ def _set_middleware_defaults(): def init_application(): # initialize the config system - conffile = _get_config_file() + conffiles = _get_config_files() # NOTE(lyarwood): Call reset to ensure the ConfigOpts object doesn't # already contain registered options if the app is reloaded. conf.CONF.reset() - # This will raise cfg.ConfigFilesNotFoundError and cfg.RequiredOptError - # when either conffile is not there or some required option is not set - # (notably the database connection string). We want both of these to - # be a hard fail and prevent the application from starting so we hard - # fail here. The error will show up in the wsgi server's logs and the - # app will not start. - _parse_args([], default_config_files=[conffile]) + # This will raise cfg.RequiredOptError when a required option is not set + # (notably the database connection string). We want this to be a hard fail + # that prevents the application from starting. The error will show up in + # the wsgi server's logs. + _parse_args([], default_config_files=conffiles) # initialize the logging system setup_logging(conf.CONF) diff --git a/requirements.txt b/requirements.txt index b46d39918..2a8781954 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,7 +12,7 @@ requests>=2.14.2 # Apache-2.0 six>=1.10.0 # MIT setuptools!=24.0.0,!=34.0.0,!=34.0.1,!=34.0.2,!=34.0.3,!=34.1.0,!=34.1.1,!=34.2.0,!=34.3.0,!=34.3.1,!=34.3.2,!=36.2.0,>=21.0.0 # PSF/ZPL oslo.concurrency>=3.26.0 # Apache-2.0 -oslo.config>=6.1.0 # Apache-2.0 +oslo.config>=6.7.0 # Apache-2.0 oslo.context>=2.19.2 # Apache-2.0 oslo.log>=3.36.0 # Apache-2.0 oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0