Expose opts entry point for version_utils
The new style oslo-config-generator needs an entry point and we have exposed this in other modules Closes-Bug: #1424576 Change-Id: Ie6d1da242b79bb1dfd03494dee82fbb73eb94217
This commit is contained in:
parent
904482959f
commit
824732d5d2
@ -17,6 +17,7 @@
|
|||||||
Helpers for comparing version strings.
|
Helpers for comparing version strings.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import copy
|
||||||
import functools
|
import functools
|
||||||
import inspect
|
import inspect
|
||||||
import logging
|
import logging
|
||||||
@ -32,13 +33,19 @@ LOG = logging.getLogger(__name__)
|
|||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
|
|
||||||
|
|
||||||
opts = [
|
deprecated_opts = [
|
||||||
cfg.BoolOpt('fatal_deprecations',
|
cfg.BoolOpt('fatal_deprecations',
|
||||||
default=False,
|
default=False,
|
||||||
help='Enables or disables fatal status of deprecations.'),
|
help='Enables or disables fatal status of deprecations.'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def list_opts():
|
||||||
|
"""Entry point for oslo.config-generator.
|
||||||
|
"""
|
||||||
|
return [(None, copy.deepcopy(deprecated_opts))]
|
||||||
|
|
||||||
|
|
||||||
class deprecated(object):
|
class deprecated(object):
|
||||||
"""A decorator to mark callables as deprecated.
|
"""A decorator to mark callables as deprecated.
|
||||||
|
|
||||||
@ -230,7 +237,7 @@ def report_deprecated_feature(logger, msg, *args, **kwargs):
|
|||||||
fatal deprecations.
|
fatal deprecations.
|
||||||
"""
|
"""
|
||||||
stdmsg = _("Deprecated: %s") % msg
|
stdmsg = _("Deprecated: %s") % msg
|
||||||
CONF.register_opts(opts)
|
CONF.register_opts(deprecated_opts)
|
||||||
if CONF.fatal_deprecations:
|
if CONF.fatal_deprecations:
|
||||||
logger.critical(stdmsg, *args, **kwargs)
|
logger.critical(stdmsg, *args, **kwargs)
|
||||||
raise DeprecatedConfig(msg=stdmsg)
|
raise DeprecatedConfig(msg=stdmsg)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user