Merge "Synced versionutils from oslo-incubator"

This commit is contained in:
Jenkins 2015-04-16 19:49:00 +00:00 committed by Gerrit Code Review
commit 2ca576585a
1 changed files with 11 additions and 2 deletions

View File

@ -17,6 +17,7 @@
Helpers for comparing version strings.
"""
import copy
import functools
import inspect
import logging
@ -32,13 +33,19 @@ LOG = logging.getLogger(__name__)
CONF = cfg.CONF
opts = [
deprecated_opts = [
cfg.BoolOpt('fatal_deprecations',
default=False,
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):
"""A decorator to mark callables as deprecated.
@ -83,6 +90,7 @@ class deprecated(object):
ICEHOUSE = 'I'
JUNO = 'J'
KILO = 'K'
LIBERTY = 'L'
_RELEASES = {
# NOTE(morganfainberg): Bexar is used for unit test purposes, it is
@ -94,6 +102,7 @@ class deprecated(object):
'I': 'Icehouse',
'J': 'Juno',
'K': 'Kilo',
'L': 'Liberty',
}
_deprecated_msg_with_alternative = _(
@ -230,7 +239,7 @@ def report_deprecated_feature(logger, msg, *args, **kwargs):
fatal deprecations.
"""
stdmsg = _("Deprecated: %s") % msg
CONF.register_opts(opts)
CONF.register_opts(deprecated_opts)
if CONF.fatal_deprecations:
logger.critical(stdmsg, *args, **kwargs)
raise DeprecatedConfig(msg=stdmsg)