From 36be0e5709f4e5fd1301e9190eb439f4e1ea2c1e Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Thu, 12 Mar 2015 07:06:12 -0400 Subject: [PATCH] Sync from oslo-incubator Pulling in changes to remove oslo namespace in _i18n module and the list_opts for better configuration support with oslo-config-generator in versionutils module (Tip of oslo-incubator is change id - Id69701978d7a1701885bf17507a1f369e1035747) Change-Id: Ibc793966fb442a870785186257ab44f1afc3e0b1 --- oslo_versionedobjects/openstack/common/_i18n.py | 4 ++-- .../openstack/common/versionutils.py | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/oslo_versionedobjects/openstack/common/_i18n.py b/oslo_versionedobjects/openstack/common/_i18n.py index af1deea..8e3facc 100644 --- a/oslo_versionedobjects/openstack/common/_i18n.py +++ b/oslo_versionedobjects/openstack/common/_i18n.py @@ -17,14 +17,14 @@ See http://docs.openstack.org/developer/oslo.i18n/usage.html """ try: - import oslo.i18n + import oslo_i18n # NOTE(dhellmann): This reference to o-s-l-o will be replaced by the # application name when this module is synced into the separate # repository. It is OK to have more than one translation function # using the same domain, since there will still only be one message # catalog. - _translators = oslo.i18n.TranslatorFactory(domain='oslo_versionedobjects') + _translators = oslo_i18n.TranslatorFactory(domain='oslo_versionedobjects') # The primary translation function using the well-known name "_" _ = _translators.primary diff --git a/oslo_versionedobjects/openstack/common/versionutils.py b/oslo_versionedobjects/openstack/common/versionutils.py index a5047e4..a1881a1 100644 --- a/oslo_versionedobjects/openstack/common/versionutils.py +++ b/oslo_versionedobjects/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)