Fix I18N deprecation warnings
The gbpservice._i18n._ translation marker function is imported where
needed, and use of the _ function for log messages is removed. This
reduces the number of unique DeprecationWarning messages output during
the master branch py27 tox job from 272 to 17. A stable/ocata-specific
import was also fixed to eliminate a DeprecationWarning message.
The remaining warnings are due to the use of deprecated keystone
authentication APIs, the use of the deprecated tenant_id and username
keys in API access policy files, and the use of tenant instead of
project_id within this project, and due to various issues in other
projects, including aci-integration-module, networking_sfc, and
python-opflex-agent.
Change-Id: I1cde26674ba368e239be299b2d130db98f2c0015
(cherry picked from commit b5b49b754e)
Conflicts:
gbpservice/neutron/plugins/ml2plus/drivers/apic_aim/apic_mapper.py
gbpservice/neutron/services/apic_aim/l3_plugin.py
gbpservice/neutron/services/grouppolicy/drivers/chain_mapping.py
gbpservice/neutron/services/grouppolicy/drivers/cisco/apic/aim_mapping.py
gbpservice/neutron/services/grouppolicy/drivers/implicit_policy.py
gbpservice/neutron/services/grouppolicy/drivers/resource_mapping.py
gbpservice/neutron/services/servicechain/plugins/ncp/node_drivers/heat_node_driver.py
This commit is contained in:
@@ -18,6 +18,7 @@ from oslo_utils import uuidutils
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import orm
|
||||
|
||||
from gbpservice._i18n import _
|
||||
from gbpservice.common import utils as gbp_utils
|
||||
from gbpservice.neutron.db.grouppolicy import group_policy_db as gpdb
|
||||
from gbpservice.neutron.extensions import group_policy as gpolicy
|
||||
|
||||
@@ -23,6 +23,8 @@ from neutron_lib.api import validators
|
||||
from neutron_lib.db import model_base
|
||||
from neutron_lib import exceptions as n_exc
|
||||
|
||||
from gbpservice._i18n import _
|
||||
|
||||
|
||||
class ImplicitSubnetpool(model_base.BASEV2):
|
||||
__tablename__ = "implicit_subnetpools"
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
from neutron_lib.api import converters
|
||||
from neutron_lib.api import extensions
|
||||
|
||||
from gbpservice._i18n import _
|
||||
from gbpservice.neutron.extensions import group_policy as gp
|
||||
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
from neutron_lib.api import extensions
|
||||
|
||||
from gbpservice._i18n import _
|
||||
from gbpservice.neutron.extensions import group_policy as gp
|
||||
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
from neutron_lib.api import converters
|
||||
from neutron_lib.api import extensions
|
||||
|
||||
from gbpservice._i18n import _
|
||||
from gbpservice.neutron.extensions import group_policy as gp
|
||||
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
from neutron_lib.api import converters as conv
|
||||
from neutron_lib.api import extensions
|
||||
|
||||
from gbpservice._i18n import _
|
||||
from gbpservice.neutron.extensions import cisco_apic
|
||||
from gbpservice.neutron.extensions import group_policy as gp
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ from neutron_lib import constants as nlib_const
|
||||
from neutron_lib import exceptions as nexc
|
||||
from oslo_config import cfg
|
||||
|
||||
from gbpservice._i18n import _
|
||||
from gbpservice.neutron.extensions import group_policy as gp
|
||||
from gbpservice.neutron.services.grouppolicy.common import exceptions as gp_exc
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ from oslo_log import log as logging
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
|
||||
from gbpservice._i18n import _
|
||||
from gbpservice.neutron import extensions as gbp_extensions
|
||||
from gbpservice.neutron.extensions import patch # noqa
|
||||
from gbpservice.neutron.services.grouppolicy.common import (
|
||||
|
||||
@@ -25,6 +25,7 @@ from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
from gbpservice._i18n import _
|
||||
from gbpservice.neutron import extensions as gbp_extensions
|
||||
import gbpservice.neutron.extensions.group_policy # noqa
|
||||
from gbpservice.neutron.services.servicechain.common import constants as scc
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
from gbpservice._i18n import _
|
||||
|
||||
|
||||
apic_opts = [
|
||||
cfg.BoolOpt('enable_optimized_dhcp', default=True),
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
|
||||
from neutron_lib import exceptions
|
||||
|
||||
from gbpservice._i18n import _
|
||||
|
||||
|
||||
class InternalError(exceptions.NeutronException):
|
||||
message = _("Internal mechanism driver error - %(details)s.")
|
||||
|
||||
@@ -44,6 +44,7 @@ from neutron.db.models import address_scope as as_db
|
||||
from neutron.db.models import allowed_address_pair as n_addr_pair_db
|
||||
from neutron.db.models import l3 as l3_db
|
||||
from neutron.db.models import securitygroup as sg_models
|
||||
from neutron.db.models import segment as segments_model
|
||||
from neutron.db import models_v2
|
||||
from neutron.db import provisioning_blocks
|
||||
from neutron.db import rbac_db_models
|
||||
@@ -4144,11 +4145,11 @@ class ApicMechanismDriver(api_plus.MechanismDriver,
|
||||
session = context.session
|
||||
|
||||
query = BAKERY(lambda s: s.query(
|
||||
segments_db.NetworkSegment))
|
||||
segments_model.NetworkSegment))
|
||||
query += lambda q: q.join(
|
||||
models.PortBindingLevel,
|
||||
models.PortBindingLevel.segment_id ==
|
||||
segments_db.NetworkSegment.id)
|
||||
segments_model.NetworkSegment.id)
|
||||
query += lambda q: q.filter(
|
||||
models.PortBindingLevel.host == sa.bindparam('host'))
|
||||
segments = query(session).params(
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
# The following is imported at the beginning to ensure
|
||||
# that the patches are applied before any of the
|
||||
# modules save a reference to the functions being patched
|
||||
from gbpservice._i18n import _
|
||||
from gbpservice._i18n import _LE
|
||||
from gbpservice._i18n import _LI
|
||||
from gbpservice.neutron.extensions import patch # noqa
|
||||
|
||||
@@ -29,6 +29,7 @@ from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
from sqlalchemy import inspect
|
||||
|
||||
from gbpservice._i18n import _
|
||||
from gbpservice._i18n import _LE
|
||||
from gbpservice._i18n import _LI
|
||||
from gbpservice.neutron import extensions as extensions_pkg
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
|
||||
from neutron_lib import exceptions
|
||||
|
||||
from gbpservice._i18n import _
|
||||
|
||||
|
||||
class GroupPolicyDriverError(exceptions.NeutronException):
|
||||
"""Policy driver call failed."""
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
from gbpservice._i18n import _
|
||||
|
||||
|
||||
group_policy_opts = [
|
||||
cfg.ListOpt('policy_drivers',
|
||||
|
||||
@@ -20,6 +20,7 @@ from oslo_serialization import jsonutils
|
||||
from oslo_utils import excutils
|
||||
import sqlalchemy as sa
|
||||
|
||||
from gbpservice._i18n import _
|
||||
from gbpservice._i18n import _LE
|
||||
from gbpservice.common import utils
|
||||
from gbpservice.network.neutronv2 import local_api
|
||||
|
||||
@@ -32,6 +32,7 @@ from oslo_log import helpers as log
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
|
||||
from gbpservice._i18n import _
|
||||
from gbpservice._i18n import _LE
|
||||
from gbpservice._i18n import _LI
|
||||
from gbpservice._i18n import _LW
|
||||
|
||||
@@ -15,6 +15,7 @@ import six
|
||||
|
||||
from neutron_lib import constants as n_constants
|
||||
|
||||
from gbpservice._i18n import _
|
||||
from gbpservice.neutron.db.grouppolicy import group_policy_mapping_db as gpdb
|
||||
from gbpservice.neutron.services.grouppolicy.common import constants as g_const
|
||||
from gbpservice.neutron.services.grouppolicy.common import exceptions as gpexc
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
from gbpservice._i18n import _
|
||||
|
||||
|
||||
# REVISIT: Auto-PTG is currently config driven to align with the
|
||||
# config driven behavior of the older driver but is slated for
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
from oslo_log import log as logging
|
||||
import re
|
||||
|
||||
from gbpservice._i18n import _
|
||||
from gbpservice.neutron.db.grouppolicy.extensions import (
|
||||
apic_allowed_vm_name_db as db)
|
||||
from gbpservice.neutron.extensions import apic_allowed_vm_name as aavnext
|
||||
|
||||
@@ -17,6 +17,7 @@ from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
import sqlalchemy as sa
|
||||
|
||||
from gbpservice._i18n import _
|
||||
from gbpservice._i18n import _LI
|
||||
from gbpservice._i18n import _LW
|
||||
from gbpservice.network.neutronv2 import local_api
|
||||
|
||||
@@ -33,6 +33,7 @@ from oslo_utils import excutils
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.orm import exc as sa_exc
|
||||
|
||||
from gbpservice._i18n import _
|
||||
from gbpservice._i18n import _LE
|
||||
from gbpservice._i18n import _LI
|
||||
from gbpservice._i18n import _LW
|
||||
|
||||
@@ -21,6 +21,7 @@ from vmware_nsxlib.v3 import config
|
||||
from vmware_nsxlib.v3 import exceptions as nsxlib_exc
|
||||
from vmware_nsxlib.v3 import resources as nsx_resources
|
||||
|
||||
from gbpservice._i18n import _
|
||||
from gbpservice.neutron.services.grouppolicy.common import constants as g_const
|
||||
from gbpservice.neutron.services.grouppolicy.common import exceptions as gpexc
|
||||
from gbpservice.neutron.services.grouppolicy.drivers import (
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
|
||||
from neutron_lib import exceptions
|
||||
|
||||
from gbpservice._i18n import _
|
||||
|
||||
|
||||
class ServiceChainDriverError(exceptions.NeutronException):
|
||||
"""ServiceChain driver call failed."""
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
from gbpservice._i18n import _
|
||||
|
||||
|
||||
service_chain_opts = [
|
||||
cfg.ListOpt('node_drivers',
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
|
||||
from neutron_lib import exceptions
|
||||
|
||||
from gbpservice._i18n import _
|
||||
|
||||
|
||||
class NodeDriverError(exceptions.NeutronException):
|
||||
"""Node driver call failed."""
|
||||
|
||||
@@ -24,6 +24,7 @@ from oslo_log import log as logging
|
||||
from oslo_serialization import jsonutils
|
||||
import sqlalchemy as sa
|
||||
|
||||
from gbpservice._i18n import _
|
||||
from gbpservice._i18n import _LE
|
||||
from gbpservice.neutron.services.servicechain.plugins.ncp import (
|
||||
exceptions as exc)
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
|
||||
from neutron_lib import exceptions
|
||||
|
||||
from gbpservice._i18n import _
|
||||
|
||||
|
||||
class UnsupportedConfiguration(exceptions.BadRequest):
|
||||
message = _("Configuration %(conf)s for object of type %(type)s is not "
|
||||
|
||||
@@ -41,8 +41,8 @@ class LoggerPlusMechanismDriver(driver_api.MechanismDriver,
|
||||
LOG.info(_LI("ensure_tenant called with tenant_id %s"), tenant_id)
|
||||
|
||||
def _log_subnetpool_call(self, method_name, context):
|
||||
LOG.info(_("%(method)s called with subnetpool settings %(current)s "
|
||||
"(original settings %(original)s)"),
|
||||
LOG.info("%(method)s called with subnetpool settings %(current)s "
|
||||
"(original settings %(original)s)",
|
||||
{'method': method_name,
|
||||
'current': context.current,
|
||||
'original': context.original})
|
||||
@@ -72,8 +72,8 @@ class LoggerPlusMechanismDriver(driver_api.MechanismDriver,
|
||||
context)
|
||||
|
||||
def _log_address_scope_call(self, method_name, context):
|
||||
LOG.info(_("%(method)s called with address_scope settings %(current)s "
|
||||
"(original settings %(original)s)"),
|
||||
LOG.info("%(method)s called with address_scope settings %(current)s "
|
||||
"(original settings %(original)s)",
|
||||
{'method': method_name,
|
||||
'current': context.current,
|
||||
'original': context.original})
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
from neutron_lib.api import extensions
|
||||
from neutron_lib import constants
|
||||
|
||||
from gbpservice._i18n import _
|
||||
from gbpservice.neutron.extensions import group_policy as gp
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user