Remove log translations
Log messages are no longer being translated. This removes all use of the _LE, _LI, and _LW translation markers to simplify logging and to avoid confusion with new contributions. See: http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html Change-Id: If4735fc3ac1803585efd90657539e540d157a59a
This commit is contained in:
parent
4ef6b4ad5a
commit
1d35146a46
@ -17,7 +17,7 @@ import abc
|
||||
import six
|
||||
import traceback
|
||||
|
||||
from kuryr.lib._i18n import _LE
|
||||
from kuryr.lib._i18n import _
|
||||
from oslo_log import log as logging
|
||||
from oslo_serialization import jsonutils
|
||||
|
||||
@ -88,7 +88,7 @@ class CNIRunner(object):
|
||||
elif params.CNI_COMMAND == 'VERSION':
|
||||
self._write_version(fout)
|
||||
else:
|
||||
raise k_exc.CNIError(_LE("unknown CNI_COMMAND: %s")
|
||||
raise k_exc.CNIError(_("unknown CNI_COMMAND: %s")
|
||||
% params.CNI_COMMAND)
|
||||
except Exception as ex:
|
||||
# LOG.exception
|
||||
|
@ -12,7 +12,7 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
from kuryr.lib._i18n import _, _LI
|
||||
from kuryr.lib._i18n import _
|
||||
from kuryr.lib import config as lib_config
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
@ -104,7 +104,6 @@ def setup_logging():
|
||||
logging.setup(CONF, 'kuryr-kubernetes')
|
||||
logging.set_defaults(default_log_levels=logging.get_default_log_levels())
|
||||
version_k8s = pbr.version.VersionInfo('kuryr-kubernetes').version_string()
|
||||
LOG.info(_LI("Logging enabled!"))
|
||||
LOG.info(_LI("%(prog)s version %(version)s"),
|
||||
{'prog': sys.argv[0],
|
||||
'version': version_k8s})
|
||||
LOG.info("Logging enabled!")
|
||||
LOG.info("%(prog)s version %(version)s",
|
||||
{'prog': sys.argv[0], 'version': version_k8s})
|
||||
|
@ -16,7 +16,7 @@
|
||||
import abc
|
||||
import six
|
||||
|
||||
from kuryr.lib._i18n import _LE
|
||||
from kuryr.lib._i18n import _
|
||||
from stevedore import driver as stv_driver
|
||||
|
||||
from kuryr_kubernetes import config
|
||||
@ -67,7 +67,7 @@ class DriverBase(object):
|
||||
|
||||
driver = manager.driver
|
||||
if not isinstance(driver, cls):
|
||||
raise TypeError(_LE("Invalid %(alias)r driver type: %(driver)s, "
|
||||
raise TypeError(_("Invalid %(alias)r driver type: %(driver)s, "
|
||||
"must be a subclass of %(type)s") % {
|
||||
'alias': alias,
|
||||
'driver': driver.__class__.__name__,
|
||||
|
@ -13,7 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from kuryr.lib._i18n import _LE
|
||||
from kuryr.lib._i18n import _
|
||||
from kuryr.lib import constants as kl_const
|
||||
from neutronclient.common import exceptions as n_exc
|
||||
from oslo_log import log as logging
|
||||
@ -82,7 +82,7 @@ class GenericPodVIFDriver(base.PodVIFDriver):
|
||||
ids = ovu.osvif_to_neutron_network_ids(subnets)
|
||||
|
||||
if len(ids) != 1:
|
||||
raise k_exc.IntegrityError(_LE(
|
||||
raise k_exc.IntegrityError(_(
|
||||
"Subnet mapping %(subnets)s is not valid: %(num_networks)s "
|
||||
"unique networks found") % {
|
||||
'subnets': subnets,
|
||||
|
@ -13,7 +13,6 @@
|
||||
# under the License.
|
||||
from time import sleep
|
||||
|
||||
from kuryr.lib._i18n import _LE
|
||||
from kuryr.lib import constants as kl_const
|
||||
from kuryr.lib import segmentation_type_drivers as seg_driver
|
||||
from neutronclient.common import exceptions as n_exc
|
||||
@ -81,9 +80,9 @@ class NestedVlanPodVIFDriver(generic_vif.GenericPodVIFDriver):
|
||||
try:
|
||||
return port['trunk_details']['trunk_id']
|
||||
except KeyError:
|
||||
LOG.error(_LE("Neutron port is missing trunk details. "
|
||||
LOG.error("Neutron port is missing trunk details. "
|
||||
"Please ensure that k8s node port is associated "
|
||||
"with a Neutron vlan trunk"))
|
||||
"with a Neutron vlan trunk")
|
||||
raise k_exc.K8sNodeTrunkPortFailure
|
||||
|
||||
def _get_parent_port(self, neutron, pod):
|
||||
@ -100,7 +99,7 @@ class NestedVlanPodVIFDriver(generic_vif.GenericPodVIFDriver):
|
||||
if pod['status']['conditions'][0]['type'] != "Initialized":
|
||||
LOG.debug("Pod condition type is not 'Initialized'")
|
||||
|
||||
LOG.error(_LE("Failed to get parent vm port ip"))
|
||||
LOG.error("Failed to get parent vm port ip")
|
||||
raise
|
||||
|
||||
try:
|
||||
@ -108,15 +107,15 @@ class NestedVlanPodVIFDriver(generic_vif.GenericPodVIFDriver):
|
||||
'ip_address=%s' % str(node_fixed_ip)]
|
||||
ports = neutron.list_ports(fixed_ips=fixed_ips)
|
||||
except n_exc.NeutronClientException as ex:
|
||||
LOG.error(_LE("Parent vm port with fixed ips %s not found!"),
|
||||
LOG.error("Parent vm port with fixed ips %s not found!",
|
||||
fixed_ips)
|
||||
raise ex
|
||||
|
||||
if ports['ports']:
|
||||
return ports['ports'][0]
|
||||
else:
|
||||
LOG.error(_LE("Neutron port for vm port with fixed ips %s"
|
||||
" not found!"), fixed_ips)
|
||||
LOG.error("Neutron port for vm port with fixed ips %s"
|
||||
" not found!", fixed_ips)
|
||||
raise k_exc.K8sNodeTrunkPortFailure
|
||||
|
||||
def _add_subport(self, neutron, trunk_id, subport):
|
||||
@ -135,8 +134,8 @@ class NestedVlanPodVIFDriver(generic_vif.GenericPodVIFDriver):
|
||||
try:
|
||||
vlan_id = self._get_vlan_id(trunk_id)
|
||||
except n_exc.NeutronClientException as ex:
|
||||
LOG.error(_LE("Getting VlanID for subport on "
|
||||
"trunk %s failed!!"), trunk_id)
|
||||
LOG.error("Getting VlanID for subport on "
|
||||
"trunk %s failed!!", trunk_id)
|
||||
raise ex
|
||||
subport = [{'segmentation_id': vlan_id,
|
||||
'port_id': subport,
|
||||
@ -146,19 +145,19 @@ class NestedVlanPodVIFDriver(generic_vif.GenericPodVIFDriver):
|
||||
{'sub_ports': subport})
|
||||
except n_exc.Conflict as ex:
|
||||
if retry_count < DEFAULT_MAX_RETRY_COUNT:
|
||||
LOG.error(_LE("vlanid already in use on trunk, "
|
||||
"%s. Retrying..."), trunk_id)
|
||||
LOG.error("vlanid already in use on trunk, "
|
||||
"%s. Retrying...", trunk_id)
|
||||
retry_count += 1
|
||||
sleep(DEFAULT_RETRY_INTERVAL)
|
||||
continue
|
||||
else:
|
||||
LOG.error(_LE(
|
||||
"MAX retry count reached. Failed to add subport"))
|
||||
LOG.error(
|
||||
"MAX retry count reached. Failed to add subport")
|
||||
raise ex
|
||||
|
||||
except n_exc.NeutronClientException as ex:
|
||||
LOG.error(_LE("Error happened during subport"
|
||||
"addition to trunk, %s"), trunk_id)
|
||||
LOG.error("Error happened during subport"
|
||||
"addition to trunk, %s", trunk_id)
|
||||
raise ex
|
||||
return vlan_id
|
||||
|
||||
@ -168,9 +167,9 @@ class NestedVlanPodVIFDriver(generic_vif.GenericPodVIFDriver):
|
||||
neutron.trunk_remove_subports(trunk_id,
|
||||
{'sub_ports': subport_id})
|
||||
except n_exc.NeutronClientException as ex:
|
||||
LOG.error(_LE(
|
||||
"Error happened during subport removal from trunk,"
|
||||
"%s"), trunk_id)
|
||||
LOG.error(
|
||||
"Error happened during subport removal from "
|
||||
"trunk, %s", trunk_id)
|
||||
raise ex
|
||||
|
||||
def _get_vlan_id(self, trunk_id):
|
||||
|
@ -13,7 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from kuryr.lib._i18n import _LE
|
||||
from kuryr.lib._i18n import _
|
||||
from oslo_log import log as logging
|
||||
from oslo_serialization import jsonutils
|
||||
import six
|
||||
@ -64,7 +64,7 @@ class LBaaSSpecHandler(k8s_base.ResourceEventHandler):
|
||||
if ip in subnet.cidr}
|
||||
|
||||
if len(subnet_ids) != 1:
|
||||
raise k_exc.IntegrityError(_LE(
|
||||
raise k_exc.IntegrityError(_(
|
||||
"Found %(num)s subnets for service %(link)s IP %(ip)s") % {
|
||||
'link': service['metadata']['selfLink'],
|
||||
'ip': ip,
|
||||
@ -138,7 +138,7 @@ class LBaaSSpecHandler(k8s_base.ResourceEventHandler):
|
||||
link_parts = svc_link.split('/')
|
||||
|
||||
if link_parts[-2] != 'services':
|
||||
raise k_exc.IntegrityError(_LE(
|
||||
raise k_exc.IntegrityError(_(
|
||||
"Unsupported service link: %(link)s") % {
|
||||
'link': svc_link})
|
||||
link_parts[-2] = 'endpoints'
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
import sys
|
||||
|
||||
from kuryr.lib._i18n import _LI
|
||||
import os_vif
|
||||
from oslo_log import log as logging
|
||||
from oslo_service import service
|
||||
@ -48,17 +47,17 @@ class KuryrK8sService(service.Service):
|
||||
pipeline.register(h_lbaas.LBaaSSpecHandler())
|
||||
|
||||
def start(self):
|
||||
LOG.info(_LI("Service '%s' starting"), self.__class__.__name__)
|
||||
LOG.info("Service '%s' starting", self.__class__.__name__)
|
||||
super(KuryrK8sService, self).start()
|
||||
self.watcher.start()
|
||||
LOG.info(_LI("Service '%s' started"), self.__class__.__name__)
|
||||
LOG.info("Service '%s' started", self.__class__.__name__)
|
||||
|
||||
def wait(self):
|
||||
super(KuryrK8sService, self).wait()
|
||||
LOG.info(_LI("Service '%s' stopped"), self.__class__.__name__)
|
||||
LOG.info("Service '%s' stopped", self.__class__.__name__)
|
||||
|
||||
def stop(self, graceful=False):
|
||||
LOG.info(_LI("Service '%s' stopping"), self.__class__.__name__)
|
||||
LOG.info("Service '%s' stopping", self.__class__.__name__)
|
||||
self.watcher.stop()
|
||||
super(KuryrK8sService, self).stop(graceful)
|
||||
|
||||
|
@ -13,8 +13,6 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from kuryr.lib._i18n import _LE
|
||||
|
||||
|
||||
class K8sClientException(Exception):
|
||||
pass
|
||||
@ -26,7 +24,7 @@ class IntegrityError(RuntimeError):
|
||||
|
||||
class ResourceNotReady(Exception):
|
||||
def __init__(self, resource):
|
||||
super(ResourceNotReady, self).__init__(_LE("Resource not ready: %r")
|
||||
super(ResourceNotReady, self).__init__("Resource not ready: %r"
|
||||
% resource)
|
||||
|
||||
|
||||
|
@ -17,7 +17,6 @@ import itertools
|
||||
from six.moves import queue as six_queue
|
||||
import time
|
||||
|
||||
from kuryr.lib._i18n import _LC
|
||||
from oslo_log import log as logging
|
||||
|
||||
|
||||
@ -104,8 +103,8 @@ class Async(base.EventHandler):
|
||||
queue = self._queues.pop(group)
|
||||
|
||||
if not queue.empty():
|
||||
LOG.critical(_LC("Asynchronous handler terminated abnormally; "
|
||||
"%(count)s events dropped for %(group)s"),
|
||||
LOG.critical("Asynchronous handler terminated abnormally; "
|
||||
"%(count)s events dropped for %(group)s",
|
||||
{'count': queue.qsize(), 'group': group})
|
||||
|
||||
if not self._queues:
|
||||
|
@ -13,7 +13,6 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from kuryr.lib._i18n import _LE
|
||||
from oslo_log import log as logging
|
||||
|
||||
from kuryr_kubernetes.handlers import base
|
||||
@ -37,4 +36,4 @@ class LogExceptions(base.EventHandler):
|
||||
try:
|
||||
self._handler(event)
|
||||
except self._exceptions:
|
||||
LOG.exception(_LE("Failed to handle event %s"), event)
|
||||
LOG.exception("Failed to handle event %s", event)
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
""" Implements linux net utils"""
|
||||
|
||||
from kuryr.lib._i18n import _LE
|
||||
from oslo_concurrency import processutils
|
||||
from oslo_log import log as logging
|
||||
|
||||
@ -34,7 +33,7 @@ def _ovs_vsctl(args, timeout=None):
|
||||
try:
|
||||
return processutils.execute(*full_args, run_as_root=True)
|
||||
except Exception as e:
|
||||
LOG.error(_LE("Unable to execute %(cmd)s. Exception: %(exception)s"),
|
||||
LOG.error("Unable to execute %(cmd)s. Exception: %(exception)s",
|
||||
{'cmd': full_args, 'exception': e})
|
||||
raise
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
import six
|
||||
|
||||
from kuryr.lib._i18n import _LE
|
||||
from kuryr.lib._i18n import _
|
||||
from kuryr.lib.binding.drivers import utils as kl_utils
|
||||
from kuryr.lib import constants as kl_const
|
||||
from os_vif.objects import fixed_ip as osv_fixed_ip
|
||||
@ -100,7 +100,7 @@ def _make_vif_subnet(subnets, subnet_id):
|
||||
network = subnets[subnet_id]
|
||||
|
||||
if len(network.subnets.objects) != 1:
|
||||
raise k_exc.IntegrityError(_LE(
|
||||
raise k_exc.IntegrityError(_(
|
||||
"Network object for subnet %(subnet_id)s is invalid, "
|
||||
"must contain a single subnet, but %(num_subnets)s found") % {
|
||||
'subnet_id': subnet_id,
|
||||
@ -138,7 +138,7 @@ def _make_vif_subnets(neutron_port, subnets):
|
||||
subnet.ips.objects.append(osv_fixed_ip.FixedIP(address=ip_address))
|
||||
|
||||
if not vif_subnets:
|
||||
raise k_exc.IntegrityError(_LE(
|
||||
raise k_exc.IntegrityError(_(
|
||||
"No valid subnets found for port %(port_id)s") % {
|
||||
'port_id': neutron_port.get('id')})
|
||||
|
||||
@ -158,7 +158,7 @@ def _make_vif_network(neutron_port, subnets):
|
||||
network = next(net.obj_clone() for net in subnets.values()
|
||||
if net.id == neutron_port.get('network_id'))
|
||||
except StopIteration:
|
||||
raise k_exc.IntegrityError(_LE(
|
||||
raise k_exc.IntegrityError(_(
|
||||
"Port %(port_id)s belongs to network %(network_id)s, "
|
||||
"but requested networks are: %(requested_networks)s") % {
|
||||
'port_id': neutron_port.get('id'),
|
||||
@ -303,7 +303,7 @@ def osvif_to_neutron_fixed_ips(subnets):
|
||||
for subnet_id, network in six.iteritems(subnets):
|
||||
ips = []
|
||||
if len(network.subnets.objects) > 1:
|
||||
raise k_exc.IntegrityError(_LE(
|
||||
raise k_exc.IntegrityError(_(
|
||||
"Network object for subnet %(subnet_id)s is invalid, "
|
||||
"must contain a single subnet, but %(num_subnets)s found") % {
|
||||
'subnet_id': subnet_id,
|
||||
|
@ -13,7 +13,6 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from kuryr.lib._i18n import _LI
|
||||
from oslo_log import log as logging
|
||||
|
||||
from kuryr_kubernetes import clients
|
||||
@ -135,7 +134,7 @@ class Watcher(object):
|
||||
|
||||
def _watch(self, path):
|
||||
try:
|
||||
LOG.info(_LI("Started watching '%s'"), path)
|
||||
LOG.info("Started watching '%s'", path)
|
||||
for event in self._client.watch(path):
|
||||
self._idle[path] = False
|
||||
self._handler(event)
|
||||
@ -145,4 +144,4 @@ class Watcher(object):
|
||||
finally:
|
||||
self._watching.pop(path)
|
||||
self._idle.pop(path)
|
||||
LOG.info(_LI("Stopped watching '%s'"), path)
|
||||
LOG.info("Stopped watching '%s'", path)
|
||||
|
3
tox.ini
3
tox.ini
@ -53,7 +53,8 @@ commands = python setup.py build_sphinx
|
||||
# E265 block comment should start with '# '
|
||||
# TODO(dougwig) -- uncomment this to test for remaining linkages
|
||||
# N530 direct neutron imports not allowed
|
||||
ignore = E125,E126,E128,E129,E265,H301,N530
|
||||
# N531 log message does not translate
|
||||
ignore = E125,E126,E128,E129,E265,H301,N530,N531
|
||||
show-source = true
|
||||
|
||||
# TODO(dougw) neutron/tests/unit/vmware exclusion is a temporary services split hack
|
||||
|
Loading…
Reference in New Issue
Block a user