From 7b659fc4e0536f4242c13ed9dd011f093e943a25 Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Thu, 16 Oct 2014 21:36:13 +0200 Subject: [PATCH] Use oslo.i18n oslo.i18n provides the i18n function that were provided by oslo-incubator's gettextutils module Import _ where needed, oslo.i18n deprecated the builtin method. Closes-Bug: #1382187 Change-Id: I12aa1c725aa4bb52a9aa46e9c3d2b303839de48b --- bin/manila-all | 6 +- bin/manila-api | 5 +- bin/manila-manage | 5 +- bin/manila-scheduler | 4 +- manila/api/auth.py | 1 + manila/api/common.py | 1 + manila/api/contrib/quotas.py | 1 + manila/api/contrib/share_actions.py | 1 + manila/api/contrib/types_extra_specs.py | 1 + manila/api/extensions.py | 1 + manila/api/middleware/auth.py | 1 + manila/api/middleware/fault.py | 1 + manila/api/middleware/sizelimit.py | 1 + manila/api/openstack/__init__.py | 1 + manila/api/openstack/urlmap.py | 1 + manila/api/openstack/volume/__init__.py | 1 + manila/api/openstack/volume/versions.py | 1 + manila/api/openstack/wsgi.py | 1 + manila/api/sizelimit.py | 1 + manila/api/v1/limits.py | 1 + manila/api/v1/security_service.py | 1 + manila/api/v1/share_metadata.py | 1 + manila/api/v1/share_networks.py | 1 + manila/api/v1/share_servers.py | 1 + manila/api/v1/share_snapshots.py | 1 + manila/api/v1/shares.py | 1 + manila/api/v1/volume_types.py | 1 + manila/api/xmlutil.py | 1 + manila/common/config.py | 1 + manila/context.py | 1 + .../versions/162a3e673105_manila_init.py | 1 + manila/db/sqlalchemy/api.py | 1 + manila/exception.py | 1 + manila/i18n.py | 71 +++++++++++++++++++ manila/manager.py | 1 + manila/network/linux/interface.py | 1 + manila/network/linux/ip_lib.py | 1 + manila/network/linux/ovs_lib.py | 1 + manila/network/neutron/api.py | 1 + manila/quota.py | 1 + manila/scheduler/chance.py | 1 + manila/scheduler/driver.py | 1 + manila/scheduler/filter_scheduler.py | 1 + manila/scheduler/filters/capacity_filter.py | 1 + manila/scheduler/host_manager.py | 1 + manila/scheduler/manager.py | 1 + manila/scheduler/scheduler_options.py | 1 + manila/scheduler/simple.py | 1 + manila/service.py | 1 + manila/share/api.py | 1 + manila/share/driver.py | 1 + .../drivers/emc/plugins/vnx/connection.py | 1 + .../share/drivers/emc/plugins/vnx/helper.py | 1 + .../drivers/emc/plugins/vnx/xml_api_parser.py | 1 + manila/share/drivers/generic.py | 1 + manila/share/drivers/glusterfs.py | 1 + manila/share/drivers/glusterfs_native.py | 1 + manila/share/drivers/netapp/api.py | 1 + manila/share/drivers/netapp/cluster_mode.py | 1 + manila/share/drivers/service_instance.py | 1 + manila/share/manager.py | 1 + manila/share/volume_types.py | 1 + .../db/migrations/alembic/test_migration.py | 1 + manila/tests/integrated/api/client.py | 1 + manila/utils.py | 1 + manila/volume/cinder.py | 1 + manila/wsgi.py | 1 + openstack-common.conf | 1 - tox.ini | 4 ++ 69 files changed, 149 insertions(+), 9 deletions(-) create mode 100644 manila/i18n.py diff --git a/bin/manila-all b/bin/manila-all index 266efcf888..7a3cecbbc6 100755 --- a/bin/manila-all +++ b/bin/manila-all @@ -39,9 +39,11 @@ possible_topdir = os.path.normpath(os.path.join if os.path.exists(os.path.join(possible_topdir, "manila", "__init__.py")): sys.path.insert(0, possible_topdir) -from manila.openstack.common import gettextutils -gettextutils.install('manila') +from manila import i18n +i18n.enable_lazy() + from manila.common import config # Need to register global_opts # noqa +from manila.i18n import _ from manila.openstack.common import log as logging from manila import service from manila import utils diff --git a/bin/manila-api b/bin/manila-api index 1c6c17e400..3b2ef86f11 100755 --- a/bin/manila-api +++ b/bin/manila-api @@ -36,8 +36,9 @@ possible_topdir = os.path.normpath(os.path.join if os.path.exists(os.path.join(possible_topdir, "manila", "__init__.py")): sys.path.insert(0, possible_topdir) -from manila.openstack.common import gettextutils -gettextutils.install('manila') +from manila import i18n +i18n.enable_lazy() + from manila.common import config # Need to register global_opts # noqa from manila.openstack.common import log as logging from manila import service diff --git a/bin/manila-manage b/bin/manila-manage index 6a76f047ca..f2ca1a0dd3 100755 --- a/bin/manila-manage +++ b/bin/manila-manage @@ -67,8 +67,8 @@ POSSIBLE_TOPDIR = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'manila', '__init__.py')): sys.path.insert(0, POSSIBLE_TOPDIR) -from manila.openstack.common import gettextutils -gettextutils.install('manila') +from manila import i18n +i18n.enable_lazy() from oslo.config import cfg @@ -76,6 +76,7 @@ from manila.common import config # Need to register global_opts # noqa from manila import context from manila import db from manila.db import migration +from manila.i18n import _ from manila.openstack.common import log as logging from manila.openstack.common import uuidutils from manila import utils diff --git a/bin/manila-scheduler b/bin/manila-scheduler index a25a497d1b..13f443a08e 100755 --- a/bin/manila-scheduler +++ b/bin/manila-scheduler @@ -34,8 +34,8 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(possible_topdir, 'manila', '__init__.py')): sys.path.insert(0, possible_topdir) -from manila.openstack.common import gettextutils -gettextutils.install('manila') +from manila import i18n +i18n.enable_lazy() from manila.common import config # Need to register global_opts # noqa from manila.openstack.common import log as logging from manila import service diff --git a/manila/api/auth.py b/manila/api/auth.py index b91139832c..17dd83c0d8 100644 --- a/manila/api/auth.py +++ b/manila/api/auth.py @@ -15,6 +15,7 @@ # under the License. from manila.api.middleware import auth +from manila.i18n import _ from manila.openstack.common import log as logging diff --git a/manila/api/common.py b/manila/api/common.py index 3657908431..d51b632dd7 100644 --- a/manila/api/common.py +++ b/manila/api/common.py @@ -23,6 +23,7 @@ import webob from manila.api.openstack import wsgi from manila.api import xmlutil +from manila.i18n import _ from manila.openstack.common import log as logging from manila import utils diff --git a/manila/api/contrib/quotas.py b/manila/api/contrib/quotas.py index 4b0868df97..d25d245306 100644 --- a/manila/api/contrib/quotas.py +++ b/manila/api/contrib/quotas.py @@ -23,6 +23,7 @@ from manila.api import xmlutil from manila import db from manila.db.sqlalchemy import api as sqlalchemy_api from manila import exception +from manila.i18n import _ from manila.openstack.common import log as logging from manila.openstack.common import strutils from manila import quota diff --git a/manila/api/contrib/share_actions.py b/manila/api/contrib/share_actions.py index dbf41f87a8..16fe986d4e 100644 --- a/manila/api/contrib/share_actions.py +++ b/manila/api/contrib/share_actions.py @@ -21,6 +21,7 @@ from manila.api import extensions from manila.api.openstack import wsgi from manila.api import xmlutil from manila import exception +from manila.i18n import _ from manila import share diff --git a/manila/api/contrib/types_extra_specs.py b/manila/api/contrib/types_extra_specs.py index aaa5bcb457..0f59febe92 100644 --- a/manila/api/contrib/types_extra_specs.py +++ b/manila/api/contrib/types_extra_specs.py @@ -23,6 +23,7 @@ from manila.api import extensions from manila.api.openstack import wsgi from manila import db from manila import exception +from manila.i18n import _ from manila import rpc from manila.share import volume_types diff --git a/manila/api/extensions.py b/manila/api/extensions.py index f9a2ba5855..02484bfb66 100644 --- a/manila/api/extensions.py +++ b/manila/api/extensions.py @@ -25,6 +25,7 @@ import manila.api.openstack from manila.api.openstack import wsgi from manila.api import xmlutil from manila import exception +from manila.i18n import _ from manila.openstack.common import importutils from manila.openstack.common import log as logging import manila.policy diff --git a/manila/api/middleware/auth.py b/manila/api/middleware/auth.py index 88953caacf..50dbdfca64 100644 --- a/manila/api/middleware/auth.py +++ b/manila/api/middleware/auth.py @@ -24,6 +24,7 @@ import webob.exc from manila.api.openstack import wsgi from manila import context +from manila.i18n import _ from manila.openstack.common import jsonutils from manila.openstack.common import log as logging from manila import wsgi as base_wsgi diff --git a/manila/api/middleware/fault.py b/manila/api/middleware/fault.py index 391fcb4033..bff7b346d2 100644 --- a/manila/api/middleware/fault.py +++ b/manila/api/middleware/fault.py @@ -19,6 +19,7 @@ import webob.dec import webob.exc from manila.api.openstack import wsgi +from manila.i18n import _ from manila.openstack.common import log as logging from manila import utils from manila import wsgi as base_wsgi diff --git a/manila/api/middleware/sizelimit.py b/manila/api/middleware/sizelimit.py index 7d4a199956..8e7401d995 100644 --- a/manila/api/middleware/sizelimit.py +++ b/manila/api/middleware/sizelimit.py @@ -21,6 +21,7 @@ import webob.dec import webob.exc +from manila.i18n import _ from manila.openstack.common import log as logging from manila import wsgi diff --git a/manila/api/openstack/__init__.py b/manila/api/openstack/__init__.py index 8f274b850d..f4ea2cf9fc 100644 --- a/manila/api/openstack/__init__.py +++ b/manila/api/openstack/__init__.py @@ -22,6 +22,7 @@ import routes from manila.api.openstack import wsgi from manila.openstack.common import log as logging +from manila.i18n import _ from manila import utils from manila import wsgi as base_wsgi diff --git a/manila/api/openstack/urlmap.py b/manila/api/openstack/urlmap.py index 4b7ab94fe0..f5cc18ca6e 100644 --- a/manila/api/openstack/urlmap.py +++ b/manila/api/openstack/urlmap.py @@ -16,6 +16,7 @@ from manila.api import urlmap from manila.openstack.common import log as logging +from manila.i18n import _ LOG = logging.getLogger(__name__) diff --git a/manila/api/openstack/volume/__init__.py b/manila/api/openstack/volume/__init__.py index b8608f0e97..98e4642aee 100644 --- a/manila/api/openstack/volume/__init__.py +++ b/manila/api/openstack/volume/__init__.py @@ -15,6 +15,7 @@ # under the License. from manila.api.v1.router import APIRouter as v1_router +from manila.i18n import _ from manila.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/manila/api/openstack/volume/versions.py b/manila/api/openstack/volume/versions.py index 5f81b43c95..80f02c544d 100644 --- a/manila/api/openstack/volume/versions.py +++ b/manila/api/openstack/volume/versions.py @@ -15,6 +15,7 @@ # under the License. from manila.api import versions +from manila.i18n import _ from manila.openstack.common import log as logging diff --git a/manila/api/openstack/wsgi.py b/manila/api/openstack/wsgi.py index 20c1c431bc..c7c971d90a 100644 --- a/manila/api/openstack/wsgi.py +++ b/manila/api/openstack/wsgi.py @@ -20,6 +20,7 @@ import time import webob from manila import exception +from manila.i18n import _ from manila.openstack.common import jsonutils from manila.openstack.common import log as logging from manila import utils diff --git a/manila/api/sizelimit.py b/manila/api/sizelimit.py index 29ae401e75..f515643db5 100644 --- a/manila/api/sizelimit.py +++ b/manila/api/sizelimit.py @@ -15,6 +15,7 @@ # under the License. from manila.api.middleware import sizelimit +from manila.i18n import _ from manila.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/manila/api/v1/limits.py b/manila/api/v1/limits.py index 24d9f1e107..bf9bd32cdd 100644 --- a/manila/api/v1/limits.py +++ b/manila/api/v1/limits.py @@ -30,6 +30,7 @@ import webob.exc from manila.api.openstack import wsgi from manila.api.views import limits as limits_views from manila.api import xmlutil +from manila.i18n import _ from manila.openstack.common import importutils from manila.openstack.common import jsonutils from manila import quota diff --git a/manila/api/v1/security_service.py b/manila/api/v1/security_service.py index 3d4a4e1888..93f20a266e 100644 --- a/manila/api/v1/security_service.py +++ b/manila/api/v1/security_service.py @@ -26,6 +26,7 @@ from manila.api import xmlutil from manila.common import constants from manila import db from manila import exception +from manila.i18n import _ from manila.openstack.common import log as logging from manila import policy diff --git a/manila/api/v1/share_metadata.py b/manila/api/v1/share_metadata.py index 00d14c4131..7d212dd4c5 100644 --- a/manila/api/v1/share_metadata.py +++ b/manila/api/v1/share_metadata.py @@ -19,6 +19,7 @@ from webob import exc from manila.api import common from manila.api.openstack import wsgi from manila import exception +from manila.i18n import _ from manila import share diff --git a/manila/api/v1/share_networks.py b/manila/api/v1/share_networks.py index 8d90d032d4..18fb4b8947 100644 --- a/manila/api/v1/share_networks.py +++ b/manila/api/v1/share_networks.py @@ -25,6 +25,7 @@ from manila.api.views import share_networks as share_networks_views from manila.api import xmlutil from manila.db import api as db_api from manila import exception +from manila.i18n import _ from manila.openstack.common import log as logging from manila import policy from manila import quota diff --git a/manila/api/v1/share_servers.py b/manila/api/v1/share_servers.py index c477e9953c..3afc106e98 100644 --- a/manila/api/v1/share_servers.py +++ b/manila/api/v1/share_servers.py @@ -23,6 +23,7 @@ from manila.api import xmlutil from manila.common import constants from manila.db import api as db_api from manila import exception +from manila.i18n import _ from manila.openstack.common import log as logging from manila import policy from manila import share diff --git a/manila/api/v1/share_snapshots.py b/manila/api/v1/share_snapshots.py index b04fc451d5..bf19d05c9c 100644 --- a/manila/api/v1/share_snapshots.py +++ b/manila/api/v1/share_snapshots.py @@ -24,6 +24,7 @@ from manila.api.openstack import wsgi from manila.api.views import share_snapshots as snapshot_views from manila.api import xmlutil from manila import exception +from manila.i18n import _ from manila.openstack.common import log as logging from manila import share diff --git a/manila/api/v1/shares.py b/manila/api/v1/shares.py index e916b5d716..0043c1d565 100644 --- a/manila/api/v1/shares.py +++ b/manila/api/v1/shares.py @@ -26,6 +26,7 @@ from manila.api.openstack import wsgi from manila.api.views import shares as share_views from manila.api import xmlutil from manila import exception +from manila.i18n import _ from manila.openstack.common import log as logging from manila.openstack.common import uuidutils from manila import share diff --git a/manila/api/v1/volume_types.py b/manila/api/v1/volume_types.py index 3944b0ae9a..b2f04b2f19 100644 --- a/manila/api/v1/volume_types.py +++ b/manila/api/v1/volume_types.py @@ -19,6 +19,7 @@ from webob import exc from manila.api.openstack import wsgi from manila.api.views import types as views_types from manila import exception +from manila.i18n import _ from manila.share import volume_types diff --git a/manila/api/xmlutil.py b/manila/api/xmlutil.py index a93751a4b4..2cc89d84aa 100644 --- a/manila/api/xmlutil.py +++ b/manila/api/xmlutil.py @@ -18,6 +18,7 @@ import os.path from lxml import etree import six +from manila.i18n import _ from manila import utils diff --git a/manila/common/config.py b/manila/common/config.py index d33bb0cb80..36b881166a 100644 --- a/manila/common/config.py +++ b/manila/common/config.py @@ -29,6 +29,7 @@ import socket from oslo.config import cfg +from manila.i18n import _ CONF = cfg.CONF diff --git a/manila/context.py b/manila/context.py index 563a3ca406..9daa9bcb68 100644 --- a/manila/context.py +++ b/manila/context.py @@ -21,6 +21,7 @@ import copy import six +from manila.i18n import _ from manila.openstack.common import context as common_context from manila.openstack.common import local from manila.openstack.common import log as logging diff --git a/manila/db/migrations/alembic/versions/162a3e673105_manila_init.py b/manila/db/migrations/alembic/versions/162a3e673105_manila_init.py index 27294fa20b..c50e195483 100644 --- a/manila/db/migrations/alembic/versions/162a3e673105_manila_init.py +++ b/manila/db/migrations/alembic/versions/162a3e673105_manila_init.py @@ -28,6 +28,7 @@ from alembic import op from sqlalchemy import Boolean, Column, DateTime, ForeignKey from sqlalchemy import Integer, MetaData, String, Table, UniqueConstraint +from manila.i18n import _ from manila.openstack.common import log as logging diff --git a/manila/db/sqlalchemy/api.py b/manila/db/sqlalchemy/api.py index a00ed571f5..0e696b7816 100644 --- a/manila/db/sqlalchemy/api.py +++ b/manila/db/sqlalchemy/api.py @@ -35,6 +35,7 @@ from sqlalchemy.sql import func from manila.common import constants from manila.db.sqlalchemy import models from manila import exception +from manila.i18n import _ from manila.openstack.common import log as logging from manila.openstack.common import timeutils diff --git a/manila/exception.py b/manila/exception.py index f8b24aa959..3b2494845f 100644 --- a/manila/exception.py +++ b/manila/exception.py @@ -26,6 +26,7 @@ from oslo.config import cfg import six import webob.exc +from manila.i18n import _ from manila.openstack.common import log as logging from manila.openstack.common import processutils diff --git a/manila/i18n.py b/manila/i18n.py new file mode 100644 index 0000000000..d53e876319 --- /dev/null +++ b/manila/i18n.py @@ -0,0 +1,71 @@ +# Copyright 2014 IBM Corp. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +"""oslo.i18n integration module. + +See http://docs.openstack.org/developer/oslo.i18n/usage.html . + +""" + +from oslo import i18n + +from manila.openstack.common import gettextutils + +DOMAIN = 'manila' + +_translators = i18n.TranslatorFactory(domain=DOMAIN) + +# The primary translation function using the well-known name "_" +_ = _translators.primary + +# Translators for log levels. +# +# The abbreviated names are meant to reflect the usual use of a short +# name like '_'. The "L" is for "log" and the other letter comes from +# the level. +_LI = _translators.log_info +_LW = _translators.log_warning +_LE = _translators.log_error +_LC = _translators.log_critical + + +def enable_lazy(): + return i18n.enable_lazy() + + +def translate(value, user_locale): + return i18n.translate(value, user_locale) + + +def get_available_languages(): + return i18n.get_available_languages(DOMAIN) + + +# Parts in oslo-incubator are still using gettextutils._(), _LI(), etc., from +# oslo-incubator. Until these parts are changed to use oslo.i18n, Manila +# needs to do something to allow them to work. One option is to continue to +# initialize gettextutils, but with the way that manila has initialization +# spread out over multiple entry points, we'll monkey-patch +# gettextutils._(), _LI(), etc., to use our oslo.i18n versions. + +# FIXME(jaegerandi): Remove the monkey-patching and update +# openstack-common.conf and do a sync with oslo-incubator to remove +# gettextutils once oslo-incubator isn't using oslo-incubator +# gettextutils any more. + +gettextutils._ = _ +gettextutils._LI = _LI +gettextutils._LW = _LW +gettextutils._LE = _LE +gettextutils._LC = _LC diff --git a/manila/manager.py b/manila/manager.py index 466c665ae7..a9a6409780 100644 --- a/manila/manager.py +++ b/manila/manager.py @@ -55,6 +55,7 @@ from oslo.config import cfg import six from manila.db import base +from manila.i18n import _ from manila.openstack.common import log as logging from manila.scheduler import rpcapi as scheduler_rpcapi from manila import version diff --git a/manila/network/linux/interface.py b/manila/network/linux/interface.py index 0c8e68758f..4cca7b1670 100644 --- a/manila/network/linux/interface.py +++ b/manila/network/linux/interface.py @@ -20,6 +20,7 @@ from oslo.config import cfg import six from manila import exception +from manila.i18n import _ from manila.network.linux import ip_lib from manila.network.linux import ovs_lib from manila.openstack.common import log as logging diff --git a/manila/network/linux/ip_lib.py b/manila/network/linux/ip_lib.py index a32d776cb4..e9aab4d146 100644 --- a/manila/network/linux/ip_lib.py +++ b/manila/network/linux/ip_lib.py @@ -16,6 +16,7 @@ import netaddr import six +from manila.i18n import _ from manila import utils diff --git a/manila/network/linux/ovs_lib.py b/manila/network/linux/ovs_lib.py index 216a45aa70..c042776010 100644 --- a/manila/network/linux/ovs_lib.py +++ b/manila/network/linux/ovs_lib.py @@ -15,6 +15,7 @@ import re +from manila.i18n import _ from manila.openstack.common import log as logging from manila import utils diff --git a/manila/network/neutron/api.py b/manila/network/neutron/api.py index 780782af4f..a54bcf20c5 100644 --- a/manila/network/neutron/api.py +++ b/manila/network/neutron/api.py @@ -19,6 +19,7 @@ from oslo.config import cfg from manila import context from manila.db import base from manila import exception +from manila.i18n import _ from manila.network import neutron from manila.network.neutron import constants as neutron_constants from manila.openstack.common import log as logging diff --git a/manila/quota.py b/manila/quota.py index 4115513ca2..3a72b54f17 100644 --- a/manila/quota.py +++ b/manila/quota.py @@ -23,6 +23,7 @@ import six from manila import db from manila import exception +from manila.i18n import _ from manila.openstack.common import importutils from manila.openstack.common import log as logging from manila.openstack.common import timeutils diff --git a/manila/scheduler/chance.py b/manila/scheduler/chance.py index 6021c24945..56af334e3f 100644 --- a/manila/scheduler/chance.py +++ b/manila/scheduler/chance.py @@ -24,6 +24,7 @@ import random from oslo.config import cfg from manila import exception +from manila.i18n import _ from manila.scheduler import driver CONF = cfg.CONF diff --git a/manila/scheduler/driver.py b/manila/scheduler/driver.py index f57f10b84e..8d8f293377 100644 --- a/manila/scheduler/driver.py +++ b/manila/scheduler/driver.py @@ -22,6 +22,7 @@ Scheduler base class that all Schedulers should inherit from from oslo.config import cfg from manila import db +from manila.i18n import _ from manila.openstack.common import importutils from manila.openstack.common import timeutils from manila.share import rpcapi as share_rpcapi diff --git a/manila/scheduler/filter_scheduler.py b/manila/scheduler/filter_scheduler.py index 98a6768791..a707ac5147 100644 --- a/manila/scheduler/filter_scheduler.py +++ b/manila/scheduler/filter_scheduler.py @@ -23,6 +23,7 @@ Weighing Functions. from oslo.config import cfg from manila import exception +from manila.i18n import _ from manila.openstack.common import log as logging from manila.scheduler import driver from manila.scheduler import scheduler_options diff --git a/manila/scheduler/filters/capacity_filter.py b/manila/scheduler/filters/capacity_filter.py index f1dc66b86e..d084243ad5 100644 --- a/manila/scheduler/filters/capacity_filter.py +++ b/manila/scheduler/filters/capacity_filter.py @@ -18,6 +18,7 @@ import math +from manila.i18n import _ from manila.openstack.common import log as logging from manila.openstack.common.scheduler import filters diff --git a/manila/scheduler/host_manager.py b/manila/scheduler/host_manager.py index 4feb09c285..9ec4404221 100644 --- a/manila/scheduler/host_manager.py +++ b/manila/scheduler/host_manager.py @@ -24,6 +24,7 @@ import six from manila import db from manila import exception +from manila.i18n import _ from manila.openstack.common import log as logging from manila.openstack.common.scheduler import filters from manila.openstack.common.scheduler import weights diff --git a/manila/scheduler/manager.py b/manila/scheduler/manager.py index 6d1ba4e388..7a0c77f862 100644 --- a/manila/scheduler/manager.py +++ b/manila/scheduler/manager.py @@ -24,6 +24,7 @@ from oslo.config import cfg from manila import context from manila import db from manila import exception +from manila.i18n import _ from manila import manager from manila.openstack.common import excutils from manila.openstack.common import importutils diff --git a/manila/scheduler/scheduler_options.py b/manila/scheduler/scheduler_options.py index 24b8be0283..8ef060bf1f 100644 --- a/manila/scheduler/scheduler_options.py +++ b/manila/scheduler/scheduler_options.py @@ -25,6 +25,7 @@ import os from oslo.config import cfg +from manila.i18n import _ from manila.openstack.common import jsonutils from manila.openstack.common import log as logging from manila.openstack.common import timeutils diff --git a/manila/scheduler/simple.py b/manila/scheduler/simple.py index 238d88b3b8..3f36342241 100644 --- a/manila/scheduler/simple.py +++ b/manila/scheduler/simple.py @@ -23,6 +23,7 @@ from oslo.config import cfg from manila import db from manila import exception +from manila.i18n import _ from manila.scheduler import chance from manila.scheduler import driver from manila import utils diff --git a/manila/service.py b/manila/service.py index 78ee82667f..55859f947d 100644 --- a/manila/service.py +++ b/manila/service.py @@ -33,6 +33,7 @@ from oslo import messaging from manila import context from manila import db from manila import exception +from manila.i18n import _ from manila.openstack.common import importutils from manila.openstack.common import log as logging from manila.openstack.common import loopingcall diff --git a/manila/share/api.py b/manila/share/api.py index 0f5f50a486..82501d6643 100644 --- a/manila/share/api.py +++ b/manila/share/api.py @@ -24,6 +24,7 @@ import six from manila.api import extensions from manila.db import base from manila import exception +from manila.i18n import _ from manila.openstack.common import excutils from manila.openstack.common import log as logging from manila.openstack.common import timeutils diff --git a/manila/share/driver.py b/manila/share/driver.py index 16eed914e3..934430bba1 100644 --- a/manila/share/driver.py +++ b/manila/share/driver.py @@ -20,6 +20,7 @@ Drivers for shares. import time from manila import exception +from manila.i18n import _ from manila.openstack.common import log as logging from manila import utils diff --git a/manila/share/drivers/emc/plugins/vnx/connection.py b/manila/share/drivers/emc/plugins/vnx/connection.py index 1114dbcff1..20154c8fbc 100644 --- a/manila/share/drivers/emc/plugins/vnx/connection.py +++ b/manila/share/drivers/emc/plugins/vnx/connection.py @@ -18,6 +18,7 @@ import six from manila import db as manila_db from manila import exception +from manila.i18n import _ from manila.openstack.common import excutils from manila.openstack.common import log from manila.share.drivers.emc.plugins import base as driver diff --git a/manila/share/drivers/emc/plugins/vnx/helper.py b/manila/share/drivers/emc/plugins/vnx/helper.py index 8092090fd7..345187a04e 100644 --- a/manila/share/drivers/emc/plugins/vnx/helper.py +++ b/manila/share/drivers/emc/plugins/vnx/helper.py @@ -22,6 +22,7 @@ from six.moves.urllib import error as url_error # pylint: disable=E0611 from six.moves.urllib import request as url_request # pylint: disable=E0611 import manila.exception +from manila.i18n import _ from manila.openstack.common import lockutils from manila.openstack.common import log as logging from manila.share.drivers.emc.plugins.vnx import constants diff --git a/manila/share/drivers/emc/plugins/vnx/xml_api_parser.py b/manila/share/drivers/emc/plugins/vnx/xml_api_parser.py index cca519eea6..16710b030d 100644 --- a/manila/share/drivers/emc/plugins/vnx/xml_api_parser.py +++ b/manila/share/drivers/emc/plugins/vnx/xml_api_parser.py @@ -15,6 +15,7 @@ import types import xml.dom.minidom +from manila.i18n import _ from manila.openstack.common import log diff --git a/manila/share/drivers/generic.py b/manila/share/drivers/generic.py index 7c4ad95dcb..e8734f0afe 100644 --- a/manila/share/drivers/generic.py +++ b/manila/share/drivers/generic.py @@ -26,6 +26,7 @@ from manila.common import constants as const from manila import compute from manila import context from manila import exception +from manila.i18n import _ from manila.openstack.common import excutils from manila.openstack.common import importutils from manila.openstack.common import log as logging diff --git a/manila/share/drivers/glusterfs.py b/manila/share/drivers/glusterfs.py index 7dd063ea8a..ec7a4eae5b 100644 --- a/manila/share/drivers/glusterfs.py +++ b/manila/share/drivers/glusterfs.py @@ -30,6 +30,7 @@ import re import xml.etree.cElementTree as etree from manila import exception +from manila.i18n import _ from manila.openstack.common import log as logging from manila.share import driver diff --git a/manila/share/drivers/glusterfs_native.py b/manila/share/drivers/glusterfs_native.py index dba7c152ad..81f8b1d375 100644 --- a/manila/share/drivers/glusterfs_native.py +++ b/manila/share/drivers/glusterfs_native.py @@ -34,6 +34,7 @@ from oslo.config import cfg import six from manila import exception +from manila.i18n import _ from manila.openstack.common import log as logging from manila.share import driver from manila.share.drivers import glusterfs diff --git a/manila/share/drivers/netapp/api.py b/manila/share/drivers/netapp/api.py index 8b7dedf80e..8c20902829 100644 --- a/manila/share/drivers/netapp/api.py +++ b/manila/share/drivers/netapp/api.py @@ -22,6 +22,7 @@ import urllib2 from lxml import etree +from manila.i18n import _ from manila.openstack.common import log diff --git a/manila/share/drivers/netapp/cluster_mode.py b/manila/share/drivers/netapp/cluster_mode.py index 1b9ce4c0a0..e48e8bc461 100644 --- a/manila/share/drivers/netapp/cluster_mode.py +++ b/manila/share/drivers/netapp/cluster_mode.py @@ -29,6 +29,7 @@ import six from manila import context from manila import exception +from manila.i18n import _ from manila.openstack.common import excutils from manila.openstack.common import log from manila.share import driver diff --git a/manila/share/drivers/service_instance.py b/manila/share/drivers/service_instance.py index a045a32ac7..b084ec189e 100644 --- a/manila/share/drivers/service_instance.py +++ b/manila/share/drivers/service_instance.py @@ -28,6 +28,7 @@ from manila.common import constants from manila import compute from manila import context from manila import exception +from manila.i18n import _ from manila.network.linux import ip_lib from manila.network.neutron import api as neutron from manila.openstack.common import importutils diff --git a/manila/share/manager.py b/manila/share/manager.py index 3fb367c62d..d0885400a0 100644 --- a/manila/share/manager.py +++ b/manila/share/manager.py @@ -25,6 +25,7 @@ import six from manila.common import constants from manila import context from manila import exception +from manila.i18n import _ from manila import manager from manila import network from manila.openstack.common import excutils diff --git a/manila/share/volume_types.py b/manila/share/volume_types.py index 9c881421fd..40d4a90c00 100644 --- a/manila/share/volume_types.py +++ b/manila/share/volume_types.py @@ -22,6 +22,7 @@ import six from manila import context from manila import db from manila import exception +from manila.i18n import _ from manila.openstack.common import log as logging CONF = cfg.CONF diff --git a/manila/tests/db/migrations/alembic/test_migration.py b/manila/tests/db/migrations/alembic/test_migration.py index c631d5b509..d8b12f5c1e 100644 --- a/manila/tests/db/migrations/alembic/test_migration.py +++ b/manila/tests/db/migrations/alembic/test_migration.py @@ -24,6 +24,7 @@ from oslo.db.sqlalchemy import test_migrations from sqlalchemy.sql import text from manila.db.migrations.alembic import migration +from manila.i18n import _ from manila.openstack.common import log as logging LOG = logging.getLogger('manila.tests.test_migrations') diff --git a/manila/tests/integrated/api/client.py b/manila/tests/integrated/api/client.py index 39e9ee2035..0e7560a46b 100644 --- a/manila/tests/integrated/api/client.py +++ b/manila/tests/integrated/api/client.py @@ -15,6 +15,7 @@ import httplib import urlparse +from manila.i18n import _ from manila.openstack.common import jsonutils from manila.openstack.common import log as logging diff --git a/manila/utils.py b/manila/utils.py index 91bde32b0d..047d42b4e9 100644 --- a/manila/utils.py +++ b/manila/utils.py @@ -43,6 +43,7 @@ import paramiko import six from manila import exception +from manila.i18n import _ from manila.openstack.common import excutils from manila.openstack.common import importutils from manila.openstack.common import lockutils diff --git a/manila/volume/cinder.py b/manila/volume/cinder.py index 8504238007..cef4ab271b 100644 --- a/manila/volume/cinder.py +++ b/manila/volume/cinder.py @@ -27,6 +27,7 @@ from oslo.config import cfg from manila.db import base from manila import exception +from manila.i18n import _ from manila.openstack.common import log as logging diff --git a/manila/wsgi.py b/manila/wsgi.py index 34c414bfe4..08cfb3bfaa 100644 --- a/manila/wsgi.py +++ b/manila/wsgi.py @@ -37,6 +37,7 @@ import webob.dec import webob.exc from manila import exception +from manila.i18n import _ from manila.openstack.common import log as logging socket_opts = [ diff --git a/openstack-common.conf b/openstack-common.conf index 516f3e072c..01c517c119 100644 --- a/openstack-common.conf +++ b/openstack-common.conf @@ -6,7 +6,6 @@ module=context module=eventlet_backdoor module=excutils module=fileutils -module=gettextutils module=importutils module=jsonutils module=local diff --git a/tox.ini b/tox.ini index 21bd400250..a8be5d98fb 100644 --- a/tox.ini +++ b/tox.ini @@ -47,3 +47,7 @@ commands = bash tools/lintstack.sh ignore = H904 builtins = _ exclude = .venv,.tox,dist,doc,openstack,*egg + +[hacking] +import_exceptions = + manila.i18n