Sync with latest oslo-incubator

Pick up the changes in versionutils.py for Liberty

Change-Id: I478986b484009531888f7aadb511f52c8371031a
This commit is contained in:
Davanum Srinivas 2015-03-20 16:04:35 -04:00
parent 2deb6fb0b2
commit 49c6d9c5ec

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)