Switch to internal _i18n pattern, as per oslo_i18n guidelines
- Guidelines referenced from: http://docs.openstack.org/developer/oslo.i18n/usage.html Change-Id: Iac380e55ee0e21f40d14acdd1bcba2cb8cc8c826 Partially-Closes-Bug: #1519493
This commit is contained in:
parent
c8961f524c
commit
c6aa58f673
|
@ -0,0 +1,42 @@
|
|||
# All Rights Reserved.
|
||||
#
|
||||
# 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.
|
||||
|
||||
import oslo_i18n
|
||||
|
||||
DOMAIN = "neutron-lbaas"
|
||||
|
||||
_translators = oslo_i18n.TranslatorFactory(domain=DOMAIN)
|
||||
|
||||
# The primary translation function using the well-known name "_"
|
||||
_ = _translators.primary
|
||||
|
||||
# The contextual translation function using the name "_C"
|
||||
_C = _translators.contextual_form
|
||||
|
||||
# The plural translation function using the name "_P"
|
||||
_P = _translators.plural_form
|
||||
|
||||
# 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 get_available_languages():
|
||||
return oslo_i18n.get_available_languages(DOMAIN)
|
|
@ -16,7 +16,6 @@
|
|||
from neutron.agent import rpc as agent_rpc
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron import context as ncontext
|
||||
from neutron.i18n import _LE, _LI
|
||||
from neutron.plugins.common import constants
|
||||
from neutron.services import provider_configuration as provconfig
|
||||
from oslo_config import cfg
|
||||
|
@ -26,6 +25,7 @@ from oslo_service import loopingcall
|
|||
from oslo_service import periodic_task
|
||||
from oslo_utils import importutils
|
||||
|
||||
from neutron_lbaas._i18n import _LE, _LI
|
||||
from neutron_lbaas.agent import agent_api
|
||||
from neutron_lbaas.drivers.common import agent_driver_base
|
||||
from neutron_lbaas.services.loadbalancer import constants as lb_const
|
||||
|
|
|
@ -18,13 +18,13 @@ import random
|
|||
from neutron.db import agents_db
|
||||
from neutron.db import agentschedulers_db
|
||||
from neutron.db import model_base
|
||||
from neutron.i18n import _LW
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import orm
|
||||
from sqlalchemy.orm import joinedload
|
||||
|
||||
from neutron_lbaas._i18n import _LW
|
||||
from neutron_lbaas.extensions import lbaas_agentschedulerv2
|
||||
from neutron_lbaas.services.loadbalancer import constants as lb_const
|
||||
|
||||
|
|
|
@ -13,12 +13,12 @@
|
|||
# under the License.
|
||||
|
||||
from barbicanclient import client as barbican_client
|
||||
from neutron.i18n import _LI, _LW, _LE
|
||||
from neutron.plugins.common import constants
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
|
||||
from neutron_lbaas._i18n import _LI, _LW, _LE
|
||||
from neutron_lbaas.common.cert_manager import cert_manager
|
||||
from neutron_lbaas.common import keystone
|
||||
|
||||
|
|
|
@ -15,10 +15,10 @@
|
|||
import os
|
||||
import uuid
|
||||
|
||||
from neutron.i18n import _LI, _LE
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
|
||||
from neutron_lbaas._i18n import _LI, _LE
|
||||
from neutron_lbaas.common.cert_manager import cert_manager
|
||||
from neutron_lbaas.common import exceptions
|
||||
|
||||
|
|
|
@ -18,7 +18,8 @@ Neutron Lbaas base exception handling.
|
|||
"""
|
||||
|
||||
from neutron.common import exceptions
|
||||
from neutron.i18n import _LE
|
||||
|
||||
from neutron_lbaas._i18n import _LE
|
||||
|
||||
|
||||
class LbaasException(exceptions.NeutronException):
|
||||
|
|
|
@ -19,7 +19,7 @@ from oslo_config import cfg
|
|||
from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
|
||||
from neutron.i18n import _LE
|
||||
from neutron_lbaas._i18n import _LE
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
|
|
@ -23,7 +23,6 @@ from neutron.db import common_db_mixin as base_db
|
|||
from neutron.db import model_base
|
||||
from neutron.db import models_v2
|
||||
from neutron.db import servicetype_db as st_db
|
||||
from neutron.i18n import _LE
|
||||
from neutron import manager
|
||||
from neutron.plugins.common import constants
|
||||
from oslo_db import exception
|
||||
|
@ -35,6 +34,7 @@ from sqlalchemy import orm
|
|||
from sqlalchemy.orm import exc
|
||||
from sqlalchemy.orm import validates
|
||||
|
||||
from neutron_lbaas._i18n import _LE
|
||||
from neutron_lbaas.extensions import loadbalancer
|
||||
from neutron_lbaas.services.loadbalancer import constants as lb_const
|
||||
|
||||
|
|
|
@ -14,11 +14,11 @@
|
|||
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.extensions import portbindings
|
||||
from neutron.i18n import _LW
|
||||
from neutron.plugins.common import constants
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging as messaging
|
||||
|
||||
from neutron_lbaas._i18n import _LW
|
||||
from neutron_lbaas.db.loadbalancer import loadbalancer_dbv2
|
||||
from neutron_lbaas.db.loadbalancer import models as db_models
|
||||
from neutron_lbaas.services.loadbalancer import data_models
|
||||
|
|
|
@ -22,12 +22,12 @@ from neutron.agent.linux import ip_lib
|
|||
from neutron.agent.linux import utils as linux_utils
|
||||
from neutron.common import exceptions
|
||||
from neutron.common import utils as n_utils
|
||||
from neutron.i18n import _LI, _LE, _LW
|
||||
from neutron.plugins.common import constants
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
|
||||
from neutron_lbaas._i18n import _LI, _LE, _LW
|
||||
from neutron_lbaas.agent import agent_device_driver
|
||||
from neutron_lbaas.services.loadbalancer import constants as lb_const
|
||||
from neutron_lbaas.services.loadbalancer import data_models
|
||||
|
|
|
@ -24,7 +24,6 @@ from neutron.common import exceptions
|
|||
from neutron.common import utils as n_utils
|
||||
from neutron import context as ncontext
|
||||
from neutron.extensions import portbindings
|
||||
from neutron.i18n import _LE, _LW
|
||||
from neutron.plugins.common import constants
|
||||
from oslo_config import cfg
|
||||
from oslo_log import helpers as log_helpers
|
||||
|
@ -32,6 +31,7 @@ from oslo_log import log as logging
|
|||
from oslo_service import service
|
||||
from oslo_utils import excutils
|
||||
|
||||
from neutron_lbaas._i18n import _LE, _LW
|
||||
from neutron_lbaas.drivers import driver_base
|
||||
from neutron_lbaas.extensions import loadbalancerv2
|
||||
from neutron_lbaas.services.loadbalancer.agent import agent as lb_agent
|
||||
|
|
|
@ -20,10 +20,10 @@ from oslo_log import log as logging
|
|||
|
||||
|
||||
from neutron import context as ncontext
|
||||
from neutron.i18n import _LE
|
||||
from neutron.plugins.common import constants
|
||||
from oslo_service import service
|
||||
|
||||
from neutron_lbaas._i18n import _LE
|
||||
from neutron_lbaas.drivers import driver_base
|
||||
from neutron_lbaas.drivers.driver_mixins import BaseManagerMixin
|
||||
from neutron_lbaas.services.loadbalancer.drivers.netscaler import ncc_client
|
||||
|
|
|
@ -13,8 +13,7 @@
|
|||
# under the License.
|
||||
|
||||
|
||||
from neutron.i18n import _LE
|
||||
|
||||
from neutron_lbaas._i18n import _LE
|
||||
from neutron_lbaas.common import exceptions
|
||||
|
||||
|
||||
|
|
|
@ -15,11 +15,11 @@
|
|||
import base64
|
||||
import httplib
|
||||
|
||||
from neutron.i18n import _LE, _LW
|
||||
from oslo_log import helpers as log_helpers
|
||||
from oslo_log import log as logging
|
||||
from oslo_serialization import jsonutils
|
||||
|
||||
from neutron_lbaas._i18n import _LE, _LW
|
||||
from neutron_lbaas.drivers.radware import exceptions as r_exc
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
|
|
@ -19,7 +19,6 @@ import time
|
|||
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron import context
|
||||
from neutron.i18n import _LE, _LW, _LI
|
||||
from neutron.plugins.common import constants
|
||||
from oslo_config import cfg
|
||||
from oslo_log import helpers as log_helpers
|
||||
|
@ -27,6 +26,7 @@ from oslo_log import log as logging
|
|||
from oslo_utils import excutils
|
||||
from six.moves import queue as Queue
|
||||
|
||||
from neutron_lbaas._i18n import _LE, _LW, _LI
|
||||
import neutron_lbaas.common.cert_manager
|
||||
from neutron_lbaas.drivers.radware import base_v2_driver
|
||||
from neutron_lbaas.drivers.radware import exceptions as r_exc
|
||||
|
|
|
@ -16,7 +16,6 @@ from neutron.agent import rpc as agent_rpc
|
|||
from neutron.common import constants as n_const
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron import context as ncontext
|
||||
from neutron.i18n import _LE, _LI
|
||||
from neutron.plugins.common import constants as np_const
|
||||
from neutron.services import provider_configuration as provconfig
|
||||
from oslo_config import cfg
|
||||
|
@ -26,6 +25,7 @@ from oslo_service import loopingcall
|
|||
from oslo_service import periodic_task
|
||||
from oslo_utils import importutils
|
||||
|
||||
from neutron_lbaas._i18n import _LE, _LI
|
||||
from neutron_lbaas.services.loadbalancer.agent import agent_api
|
||||
from neutron_lbaas.services.loadbalancer import constants as l_const
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ from neutron.common import constants
|
|||
from neutron.db import agents_db
|
||||
from neutron.db import agentschedulers_db
|
||||
from neutron.db import model_base
|
||||
from neutron.i18n import _LW
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
import sqlalchemy as sa
|
||||
|
@ -28,6 +27,7 @@ from sqlalchemy import orm
|
|||
from sqlalchemy.orm import joinedload
|
||||
|
||||
from abc import abstractmethod
|
||||
from neutron_lbaas._i18n import _LW
|
||||
from neutron_lbaas.extensions import lbaas_agentscheduler
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
|
|
@ -19,7 +19,6 @@ from neutron.common import exceptions as n_exc
|
|||
from neutron.common import rpc as n_rpc
|
||||
from neutron.db import agents_db
|
||||
from neutron.extensions import portbindings
|
||||
from neutron.i18n import _LW
|
||||
from neutron.plugins.common import constants as np_const
|
||||
from neutron.services import provider_configuration as provconf
|
||||
from oslo_config import cfg
|
||||
|
@ -27,6 +26,7 @@ from oslo_log import log as logging
|
|||
import oslo_messaging
|
||||
from oslo_utils import importutils
|
||||
|
||||
from neutron_lbaas._i18n import _LW
|
||||
from neutron_lbaas.db.loadbalancer import loadbalancer_db
|
||||
from neutron_lbaas.extensions import lbaas_agentscheduler
|
||||
from neutron_lbaas.services.loadbalancer import constants as l_const
|
||||
|
|
|
@ -21,12 +21,12 @@ from neutron.agent.linux import ip_lib
|
|||
from neutron.agent.linux import utils
|
||||
from neutron.common import exceptions
|
||||
from neutron.common import utils as n_utils
|
||||
from neutron.i18n import _LE, _LW
|
||||
from neutron.plugins.common import constants
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
|
||||
from neutron_lbaas._i18n import _LE, _LW
|
||||
from neutron_lbaas.services.loadbalancer.agent import agent_device_driver
|
||||
from neutron_lbaas.services.loadbalancer import constants as lb_const
|
||||
from neutron_lbaas.services.loadbalancer.drivers.haproxy import cfg as hacfg
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron.i18n import _LW
|
||||
from oslo_log import log as logging
|
||||
|
||||
from neutron_lbaas._i18n import _LW
|
||||
from neutron_lbaas.drivers.haproxy import synchronous_namespace_driver
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron.i18n import _LW
|
||||
from oslo_log import log as logging
|
||||
|
||||
from neutron_lbaas._i18n import _LW
|
||||
from neutron_lbaas.drivers import logging_noop
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
# Copyright 2014 Citrix Systems
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
|
@ -15,11 +16,11 @@
|
|||
import requests
|
||||
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.i18n import _LE
|
||||
from neutron.i18n import _LI
|
||||
from oslo_log import log as logging
|
||||
from oslo_serialization import jsonutils
|
||||
|
||||
from neutron_lbaas._i18n import _LE, _LI
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
CONTENT_TYPE_HEADER = 'Content-type'
|
||||
|
|
|
@ -13,11 +13,11 @@
|
|||
# under the License.
|
||||
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.i18n import _LI
|
||||
from neutron.plugins.common import constants
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
|
||||
from neutron_lbaas._i18n import _LI
|
||||
from neutron_lbaas.db.loadbalancer import loadbalancer_db
|
||||
from neutron_lbaas.services.loadbalancer.drivers import abstract_driver
|
||||
from neutron_lbaas.services.loadbalancer.drivers.netscaler import ncc_client
|
||||
|
|
|
@ -25,7 +25,6 @@ eventlet.monkey_patch(thread=True)
|
|||
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron import context as ncontext
|
||||
from neutron.i18n import _LE, _LI, _LW
|
||||
from neutron.plugins.common import constants
|
||||
from oslo_config import cfg
|
||||
from oslo_log import helpers as log_helpers
|
||||
|
@ -34,6 +33,7 @@ from oslo_serialization import jsonutils
|
|||
from oslo_utils import excutils
|
||||
from six.moves import queue as Queue
|
||||
|
||||
from neutron_lbaas._i18n import _LE, _LI, _LW
|
||||
from neutron_lbaas.db.loadbalancer import loadbalancer_db as lb_db
|
||||
from neutron_lbaas.extensions import loadbalancer
|
||||
from neutron_lbaas.services.loadbalancer.drivers import abstract_driver
|
||||
|
|
|
@ -19,7 +19,6 @@ from neutron.api.v2 import attributes as attrs
|
|||
from neutron.common import exceptions as n_exc
|
||||
from neutron import context as ncontext
|
||||
from neutron.db import servicetype_db as st_db
|
||||
from neutron.i18n import _LI, _LE
|
||||
from neutron.plugins.common import constants
|
||||
from neutron.services import provider_configuration as pconf
|
||||
from neutron.services import service_base
|
||||
|
@ -27,6 +26,7 @@ from oslo_config import cfg
|
|||
from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
|
||||
from neutron_lbaas._i18n import _LI, _LE
|
||||
from neutron_lbaas import agent_scheduler as agent_scheduler_v2
|
||||
import neutron_lbaas.common.cert_manager
|
||||
from neutron_lbaas.common.tls_utils import cert_parser
|
||||
|
|
|
@ -15,11 +15,10 @@
|
|||
import os
|
||||
import time
|
||||
|
||||
from neutron.i18n import _, _LI
|
||||
from oslo_log import log as logging
|
||||
from tempest_lib import exceptions
|
||||
|
||||
# from neutron_lbaas.tests.tempest.lib import clients as tempest_clients
|
||||
from neutron_lbaas._i18n import _, _LI
|
||||
from neutron_lbaas.tests.tempest.lib import config
|
||||
from neutron_lbaas.tests.tempest.v1.api import base
|
||||
from neutron_lbaas.tests.tempest.v2.clients import health_monitors_client
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
import subprocess
|
||||
|
||||
import netaddr
|
||||
from neutron.i18n import _LI, _LW, _LE
|
||||
from oslo_log import log
|
||||
import six
|
||||
from tempest_lib.common.utils import data_utils
|
||||
|
@ -25,6 +24,7 @@ from tempest_lib.common.utils import misc as misc_utils
|
|||
from tempest_lib import exceptions as lib_exc
|
||||
from tempest_lib import exceptions
|
||||
|
||||
from neutron_lbaas._i18n import _LI, _LW, _LE
|
||||
from neutron_lbaas.tests.tempest.lib.common import fixed_network
|
||||
from neutron_lbaas.tests.tempest.lib.common.utils.linux import remote_client
|
||||
from neutron_lbaas.tests.tempest.lib import config
|
||||
|
|
2
tox.ini
2
tox.ini
|
@ -60,7 +60,7 @@ builtins = _
|
|||
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools,.ropeproject,rally-scenarios,neutron_lbaas/tests/tempest/lib,neutron_lbaas/tests/tempest/v1/api
|
||||
|
||||
[hacking]
|
||||
import_exceptions = neutron.i18n
|
||||
import_exceptions = neutron_lbaas._i18n
|
||||
local-check-factory = neutron.hacking.checks.factory
|
||||
|
||||
# If you are running the tests locally you should set the env variable
|
||||
|
|
Loading…
Reference in New Issue