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
This commit is contained in:
Davanum Srinivas
2015-03-12 07:06:12 -04:00
committed by Davanum Srinivas (dims)
parent 4201a4f980
commit 36be0e5709
2 changed files with 14 additions and 5 deletions

View File

@@ -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

View File

@@ -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)