From: Michal Dulko Date: Wed, 25 Mar 2015 11:03:51 +0000 (+0100) Subject: Syncing versionutils from oslo-incubator X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=41d60adb53702ffa0d24122402e46615dfc4c1ff;p=openstack-build%2Fcinder-build.git Syncing versionutils from oslo-incubator This is to fix deprecation warnings caused by a fact that version that's currently in Cinder imports oslo.config instead of oslo_config. Change-Id: Iaf0bea76e5bb389cb052de1ecb34a8b24ae39343 Closes-Bug: 1436270 --- diff --git a/cinder/openstack/common/versionutils.py b/cinder/openstack/common/versionutils.py index b80b69d68..6fe107b52 100644 --- a/cinder/openstack/common/versionutils.py +++ b/cinder/openstack/common/versionutils.py @@ -17,11 +17,12 @@ Helpers for comparing version strings. """ +import copy import functools import inspect import logging -from oslo.config import cfg +from oslo_config import cfg import pkg_resources import six @@ -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)