Merge "Deprecate usage of ironic.api.wsgi:initialize_wsgi_app"

This commit is contained in:
Zuul
2025-09-22 17:04:12 +00:00
committed by Gerrit Code Review
3 changed files with 30 additions and 11 deletions

View File

@@ -92,19 +92,17 @@ Passing Configuration Options
------------------------------
By default, Ironic will use its standard configuration file search paths.
If you need to specify a custom configuration file:
See https://docs.openstack.org/oslo.config/latest/configuration/options.html
for more info.
For the initialization method with arguments::
If you need to specify a custom configuration file, you can set the
``IRONIC_CONFIG_FILE`` and/or ``IRONIC_CONFIG_DIR`` environment variable:
.. code-block:: cfg
# uWSGI with custom config (in ini file)
[uwsgi]
module = ironic.api.wsgi:initialize_wsgi_app(argv=["--config-file=/etc/ironic/ironic.conf"])
Alternatively, you can set environment variables before starting the WSGI server::
export OS_CLOUD=mycloud
# or
export IRONIC_CONF=/etc/ironic/ironic.conf
...
env = IRONIC_CONFIG_DIR=/etc/mycustomdir/
Important Considerations
~~~~~~~~~~~~~~~~~~~~~~~~

View File

@@ -15,6 +15,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import os
from oslo_config import cfg
import osprofiler.opts as profiler_opts
@@ -23,10 +25,21 @@ from ironic import version
def parse_args(argv, default_config_files=None):
# NOTE(amorin) allow wsgi app to start with custom config file/dir
conf_file_from_env = os.environ.get('IRONIC_CONFIG_FILE')
if conf_file_from_env and not default_config_files:
default_config_files = [conf_file_from_env]
conf_dir_from_env = os.environ.get('IRONIC_CONFIG_DIR')
if conf_dir_from_env:
default_config_dirs = [conf_dir_from_env]
else:
default_config_dirs = None
rpc.set_defaults(control_exchange='ironic')
cfg.CONF(argv[1:],
project='ironic',
version=version.version_info.release_string(),
default_config_files=default_config_files)
default_config_files=default_config_files,
default_config_dirs=default_config_dirs)
rpc.init(cfg.CONF)
profiler_opts.set_defaults(cfg.CONF)

View File

@@ -0,0 +1,8 @@
---
deprecations:
- |
Using ``ironic.api.wsgi:initialize_wsgi_app`` to provide custom config file
to ironic is now deprecated.
Instead, two new environment variables ``IRONIC_CONFIG_DIR`` and
``IRONIC_CONFIG_FILE`` are introduced to provide the same functionality.