Drop 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: I9b383ef3fd9a6487b1ee7726d892d1a94e3d9370
This commit is contained in:
parent
f8bf9d0443
commit
5a045e3db1
3
tox.ini
3
tox.ini
@ -83,7 +83,8 @@ commands = sphinx-build -W -b html doc/source doc/build/html
|
|||||||
# E125 continuation line does not distinguish itself from next logical line
|
# E125 continuation line does not distinguish itself from next logical line
|
||||||
# E129 visually indented line with same indent as next logical line
|
# E129 visually indented line with same indent as next logical line
|
||||||
# N530 direct neutron imports not allowed
|
# N530 direct neutron imports not allowed
|
||||||
ignore = N530,E125,E129
|
# N531 translations hints
|
||||||
|
ignore = N530,E125,E129,N531
|
||||||
show-source = true
|
show-source = true
|
||||||
builtins = _
|
builtins = _
|
||||||
exclude = build,dist
|
exclude = build,dist
|
||||||
|
@ -28,16 +28,6 @@ _C = _translators.contextual_form
|
|||||||
# The plural translation function using the name "_P"
|
# The plural translation function using the name "_P"
|
||||||
_P = _translators.plural_form
|
_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():
|
def get_available_languages():
|
||||||
return oslo_i18n.get_available_languages(DOMAIN)
|
return oslo_i18n.get_available_languages(DOMAIN)
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
|
|
||||||
from vmware_nsxlib._i18n import _, _LW
|
from vmware_nsxlib._i18n import _
|
||||||
from vmware_nsxlib.v3 import client
|
from vmware_nsxlib.v3 import client
|
||||||
from vmware_nsxlib.v3 import cluster
|
from vmware_nsxlib.v3 import cluster
|
||||||
from vmware_nsxlib.v3 import exceptions
|
from vmware_nsxlib.v3 import exceptions
|
||||||
@ -389,9 +389,9 @@ class NsxLibLogicalRouter(utils.NsxLibApiBase):
|
|||||||
matched_num = matched_num + 1
|
matched_num = matched_num + 1
|
||||||
if matched_num == 0:
|
if matched_num == 0:
|
||||||
if skip_not_found:
|
if skip_not_found:
|
||||||
LOG.warning(_LW("No resource in %(res)s matched for values: "
|
LOG.warning("No resource in %(res)s matched for values: "
|
||||||
"%(values)s"), {'res': resource,
|
"%(values)s", {'res': resource,
|
||||||
'values': kwargs})
|
'values': kwargs})
|
||||||
else:
|
else:
|
||||||
err_msg = (_("No resource in %(res)s matched for values: "
|
err_msg = (_("No resource in %(res)s matched for values: "
|
||||||
"%(values)s") % {'res': resource,
|
"%(values)s") % {'res': resource,
|
||||||
@ -400,10 +400,10 @@ class NsxLibLogicalRouter(utils.NsxLibApiBase):
|
|||||||
manager=self.cluster.nsx_api_managers,
|
manager=self.cluster.nsx_api_managers,
|
||||||
operation=err_msg)
|
operation=err_msg)
|
||||||
elif matched_num > 1:
|
elif matched_num > 1:
|
||||||
LOG.warning(_LW("%(num)s resources in %(res)s matched for values: "
|
LOG.warning("%(num)s resources in %(res)s matched for values: "
|
||||||
"%(values)s"), {'num': matched_num,
|
"%(values)s", {'num': matched_num,
|
||||||
'res': resource,
|
'res': resource,
|
||||||
'values': kwargs})
|
'values': kwargs})
|
||||||
|
|
||||||
def add_nat_rule(self, logical_router_id, action, translated_network,
|
def add_nat_rule(self, logical_router_id, action, translated_network,
|
||||||
source_net=None, dest_net=None,
|
source_net=None, dest_net=None,
|
||||||
|
@ -18,7 +18,7 @@ import six.moves.urllib.parse as urlparse
|
|||||||
|
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
from oslo_serialization import jsonutils
|
from oslo_serialization import jsonutils
|
||||||
from vmware_nsxlib._i18n import _, _LW
|
from vmware_nsxlib._i18n import _
|
||||||
from vmware_nsxlib.v3 import exceptions
|
from vmware_nsxlib.v3 import exceptions
|
||||||
from vmware_nsxlib.v3 import utils
|
from vmware_nsxlib.v3 import utils
|
||||||
|
|
||||||
@ -119,9 +119,9 @@ class RESTClient(object):
|
|||||||
def _validate_result(self, result, expected, operation):
|
def _validate_result(self, result, expected, operation):
|
||||||
if result.status_code not in expected:
|
if result.status_code not in expected:
|
||||||
result_msg = result.json() if result.content else ''
|
result_msg = result.json() if result.content else ''
|
||||||
LOG.warning(_LW("The HTTP request returned error code "
|
LOG.warning("The HTTP request returned error code "
|
||||||
"%(result)s, whereas %(expected)s response "
|
"%(result)s, whereas %(expected)s response "
|
||||||
"codes were expected. Response body %(body)s"),
|
"codes were expected. Response body %(body)s",
|
||||||
{'result': result.status_code,
|
{'result': result.status_code,
|
||||||
'expected': '/'.join([str(code)
|
'expected': '/'.join([str(code)
|
||||||
for code in expected]),
|
for code in expected]),
|
||||||
|
@ -21,7 +21,7 @@ import uuid
|
|||||||
from neutron_lib import exceptions
|
from neutron_lib import exceptions
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
|
|
||||||
from vmware_nsxlib._i18n import _, _LE
|
from vmware_nsxlib._i18n import _
|
||||||
from vmware_nsxlib.v3 import exceptions as nsxlib_exceptions
|
from vmware_nsxlib.v3 import exceptions as nsxlib_exceptions
|
||||||
|
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
@ -177,13 +177,13 @@ class ClientCertificateManager(object):
|
|||||||
self._nsx_trust_management.delete_cert_and_identity(
|
self._nsx_trust_management.delete_cert_and_identity(
|
||||||
self._identity, cert_pem)
|
self._identity, cert_pem)
|
||||||
except nsxlib_exceptions.ManagerError as e:
|
except nsxlib_exceptions.ManagerError as e:
|
||||||
LOG.error(_LE("Failed to clear certificate on backend: %s"), e)
|
LOG.error("Failed to clear certificate on backend: %s", e)
|
||||||
ok = False
|
ok = False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self._storage_driver.delete_cert(self._identity)
|
self._storage_driver.delete_cert(self._identity)
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.error(_LE("Failed to clear certificate in storage: %s"), e)
|
LOG.error("Failed to clear certificate in storage: %s", e)
|
||||||
ok = False
|
ok = False
|
||||||
|
|
||||||
self._cert = None
|
self._cert = None
|
||||||
|
@ -31,7 +31,7 @@ from oslo_log import log
|
|||||||
from oslo_service import loopingcall
|
from oslo_service import loopingcall
|
||||||
from requests import adapters
|
from requests import adapters
|
||||||
from requests import exceptions as requests_exceptions
|
from requests import exceptions as requests_exceptions
|
||||||
from vmware_nsxlib._i18n import _, _LI, _LW
|
from vmware_nsxlib._i18n import _
|
||||||
from vmware_nsxlib.v3 import client as nsx_client
|
from vmware_nsxlib.v3 import client as nsx_client
|
||||||
from vmware_nsxlib.v3 import exceptions
|
from vmware_nsxlib.v3 import exceptions
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ class TimeoutSession(requests.Session):
|
|||||||
# This is most probably "client cert not found" error (this
|
# This is most probably "client cert not found" error (this
|
||||||
# happens when server closed the connection and requests
|
# happens when server closed the connection and requests
|
||||||
# reopen it). Try reloading client cert.
|
# reopen it). Try reloading client cert.
|
||||||
LOG.warning(_LW("SSL error: %s, retrying..") % e)
|
LOG.warning("SSL error: %s, retrying.." % e)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
# Lack of client cert file can come in form of OSError,
|
# Lack of client cert file can come in form of OSError,
|
||||||
# in this case filename will appear in the error. Try
|
# in this case filename will appear in the error. Try
|
||||||
@ -125,7 +125,7 @@ class TimeoutSession(requests.Session):
|
|||||||
if self._cert_provider.filename() not in str(e):
|
if self._cert_provider.filename() not in str(e):
|
||||||
raise e
|
raise e
|
||||||
# Don't expose cert file name to the logs
|
# Don't expose cert file name to the logs
|
||||||
LOG.warning(_LW("Reloading client certificate.."))
|
LOG.warning("Reloading client certificate..")
|
||||||
|
|
||||||
# The following with statement allows for preparing certificate and
|
# The following with statement allows for preparing certificate and
|
||||||
# private key file and dispose it once connections are spawned
|
# private key file and dispose it once connections are spawned
|
||||||
@ -262,8 +262,8 @@ class Endpoint(object):
|
|||||||
|
|
||||||
def set_state(self, state):
|
def set_state(self, state):
|
||||||
if self.state != state:
|
if self.state != state:
|
||||||
LOG.info(_LI("Endpoint '%(ep)s' changing from state"
|
LOG.info("Endpoint '%(ep)s' changing from state"
|
||||||
" '%(old)s' to '%(new)s'"),
|
" '%(old)s' to '%(new)s'",
|
||||||
{'ep': self.provider,
|
{'ep': self.provider,
|
||||||
'old': self.state,
|
'old': self.state,
|
||||||
'new': state})
|
'new': state})
|
||||||
@ -411,15 +411,15 @@ class ClusteredAPI(object):
|
|||||||
self._http_provider.validate_connection(self, endpoint, conn)
|
self._http_provider.validate_connection(self, endpoint, conn)
|
||||||
endpoint.set_state(EndpointState.UP)
|
endpoint.set_state(EndpointState.UP)
|
||||||
except exceptions.ClientCertificateNotTrusted:
|
except exceptions.ClientCertificateNotTrusted:
|
||||||
LOG.warning(_LW("Failed to validate API cluster endpoint "
|
LOG.warning("Failed to validate API cluster endpoint "
|
||||||
"'%(ep)s' due to untrusted client certificate"),
|
"'%(ep)s' due to untrusted client certificate",
|
||||||
{'ep': endpoint})
|
{'ep': endpoint})
|
||||||
# regenerate connection pool based on new certificate
|
# regenerate connection pool based on new certificate
|
||||||
endpoint.regenerate_pool()
|
endpoint.regenerate_pool()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
endpoint.set_state(EndpointState.DOWN)
|
endpoint.set_state(EndpointState.DOWN)
|
||||||
LOG.warning(_LW("Failed to validate API cluster endpoint "
|
LOG.warning("Failed to validate API cluster endpoint "
|
||||||
"'%(ep)s' due to: %(err)s"),
|
"'%(ep)s' due to: %(err)s",
|
||||||
{'ep': endpoint, 'err': e})
|
{'ep': endpoint, 'err': e})
|
||||||
|
|
||||||
def _select_endpoint(self):
|
def _select_endpoint(self):
|
||||||
@ -460,8 +460,8 @@ class ClusteredAPI(object):
|
|||||||
cluster_id=self.cluster_id)
|
cluster_id=self.cluster_id)
|
||||||
|
|
||||||
if endpoint.pool.free() == 0:
|
if endpoint.pool.free() == 0:
|
||||||
LOG.info(_LI("API endpoint %(ep)s at connection "
|
LOG.info("API endpoint %(ep)s at connection "
|
||||||
"capacity %(max)s and has %(waiting)s waiting"),
|
"capacity %(max)s and has %(waiting)s waiting",
|
||||||
{'ep': endpoint,
|
{'ep': endpoint,
|
||||||
'max': endpoint.pool.max_size,
|
'max': endpoint.pool.max_size,
|
||||||
'waiting': endpoint.pool.waiting()})
|
'waiting': endpoint.pool.waiting()})
|
||||||
@ -496,7 +496,7 @@ class ClusteredAPI(object):
|
|||||||
|
|
||||||
return response
|
return response
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.warning(_LW("Request failed due to: %s"), e)
|
LOG.warning("Request failed due to: %s", e)
|
||||||
if not self._http_provider.is_connection_exception(e):
|
if not self._http_provider.is_connection_exception(e):
|
||||||
# only trap and retry connection errors
|
# only trap and retry connection errors
|
||||||
raise e
|
raise e
|
||||||
@ -541,8 +541,8 @@ class NSXClusteredAPI(ClusteredAPI):
|
|||||||
provider_index += 1
|
provider_index += 1
|
||||||
conf_url = _schemed_url(conf_url)
|
conf_url = _schemed_url(conf_url)
|
||||||
if conf_url in urls:
|
if conf_url in urls:
|
||||||
LOG.warning(_LW("'%s' already defined in configuration file. "
|
LOG.warning("'%s' already defined in configuration file. "
|
||||||
"Skipping."), urlparse.urlunparse(conf_url))
|
"Skipping.", urlparse.urlunparse(conf_url))
|
||||||
continue
|
continue
|
||||||
urls.append(conf_url)
|
urls.append(conf_url)
|
||||||
providers.append(
|
providers.append(
|
||||||
|
@ -16,9 +16,6 @@
|
|||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
from oslo_log import versionutils
|
from oslo_log import versionutils
|
||||||
|
|
||||||
from vmware_nsxlib._i18n import _LW
|
|
||||||
|
|
||||||
|
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@ -118,8 +115,8 @@ class NsxLibConfig(object):
|
|||||||
# this is deprecated, and never used.
|
# this is deprecated, and never used.
|
||||||
versionutils.report_deprecated_feature(
|
versionutils.report_deprecated_feature(
|
||||||
LOG,
|
LOG,
|
||||||
_LW('dhcp_profile_uuid is not used by the nsxlib, and will '
|
'dhcp_profile_uuid is not used by the nsxlib, and will '
|
||||||
'be removed from its configuration in the future.'))
|
'be removed from its configuration in the future.')
|
||||||
|
|
||||||
def _attribute_by_index(self, scalar_or_list, index):
|
def _attribute_by_index(self, scalar_or_list, index):
|
||||||
if isinstance(scalar_or_list, list):
|
if isinstance(scalar_or_list, list):
|
||||||
|
@ -19,7 +19,7 @@ import uuid
|
|||||||
|
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
|
|
||||||
from vmware_nsxlib._i18n import _, _LW
|
from vmware_nsxlib._i18n import _
|
||||||
from vmware_nsxlib.v3 import exceptions
|
from vmware_nsxlib.v3 import exceptions
|
||||||
from vmware_nsxlib.v3 import nsx_constants as consts
|
from vmware_nsxlib.v3 import nsx_constants as consts
|
||||||
|
|
||||||
@ -72,16 +72,16 @@ class NSGroupManager(object):
|
|||||||
if nested_groups:
|
if nested_groups:
|
||||||
size = max(requested_size, max(nested_groups) + 1)
|
size = max(requested_size, max(nested_groups) + 1)
|
||||||
if size > requested_size:
|
if size > requested_size:
|
||||||
LOG.warning(_LW("Lowering the value of "
|
LOG.warning("Lowering the value of "
|
||||||
"nsx_v3:number_of_nested_groups isn't "
|
"nsx_v3:number_of_nested_groups isn't "
|
||||||
"supported, '%s' nested-groups will be used."),
|
"supported, '%s' nested-groups will be used.",
|
||||||
size)
|
size)
|
||||||
|
|
||||||
absent_groups = set(range(size)) - set(nested_groups.keys())
|
absent_groups = set(range(size)) - set(nested_groups.keys())
|
||||||
if absent_groups:
|
if absent_groups:
|
||||||
LOG.warning(
|
LOG.warning(
|
||||||
_LW("Found %(num_present)s Nested Groups, "
|
"Found %(num_present)s Nested Groups, "
|
||||||
"creating %(num_absent)s more."),
|
"creating %(num_absent)s more.",
|
||||||
{'num_present': len(nested_groups),
|
{'num_present': len(nested_groups),
|
||||||
'num_absent': len(absent_groups)})
|
'num_absent': len(absent_groups)})
|
||||||
for i in absent_groups:
|
for i in absent_groups:
|
||||||
@ -139,11 +139,11 @@ class NSGroupManager(object):
|
|||||||
nsgroup_id, verify=True)
|
nsgroup_id, verify=True)
|
||||||
break
|
break
|
||||||
except exceptions.NSGroupMemberNotFound:
|
except exceptions.NSGroupMemberNotFound:
|
||||||
LOG.warning(_LW("NSGroup %(nsgroup)s was expected to be found "
|
LOG.warning("NSGroup %(nsgroup)s was expected to be found "
|
||||||
"in group %(group_id)s, but wasn't. "
|
"in group %(group_id)s, but wasn't. "
|
||||||
"Looking in the next group.."),
|
"Looking in the next group..",
|
||||||
{'nsgroup': nsgroup_id, 'group_id': group})
|
{'nsgroup': nsgroup_id, 'group_id': group})
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
LOG.warning(_LW("NSGroup %s was marked for removal, but its "
|
LOG.warning("NSGroup %s was marked for removal, but its "
|
||||||
"reference is missing."), nsgroup_id)
|
"reference is missing.", nsgroup_id)
|
||||||
|
@ -21,7 +21,7 @@ import copy
|
|||||||
from neutron_lib import exceptions as n_exc
|
from neutron_lib import exceptions as n_exc
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
|
|
||||||
from vmware_nsxlib._i18n import _, _LW
|
from vmware_nsxlib._i18n import _
|
||||||
from vmware_nsxlib.v3 import exceptions
|
from vmware_nsxlib.v3 import exceptions
|
||||||
from vmware_nsxlib.v3 import nsx_constants
|
from vmware_nsxlib.v3 import nsx_constants
|
||||||
from vmware_nsxlib.v3 import utils
|
from vmware_nsxlib.v3 import utils
|
||||||
@ -102,8 +102,8 @@ class RouterLib(object):
|
|||||||
tier1_link_port = (
|
tier1_link_port = (
|
||||||
self._router_port_client.get_tier1_link_port(tier1_uuid))
|
self._router_port_client.get_tier1_link_port(tier1_uuid))
|
||||||
except exceptions.ResourceNotFound:
|
except exceptions.ResourceNotFound:
|
||||||
LOG.warning(_LW("Logical router link port for tier1 router: %s "
|
LOG.warning("Logical router link port for tier1 router: %s "
|
||||||
"not found at the backend"), tier1_uuid)
|
"not found at the backend", tier1_uuid)
|
||||||
return
|
return
|
||||||
tier1_link_port_id = tier1_link_port['id']
|
tier1_link_port_id = tier1_link_port['id']
|
||||||
tier0_link_port_id = (
|
tier0_link_port_id = (
|
||||||
|
@ -22,7 +22,6 @@ from neutron_lib import constants
|
|||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
from oslo_utils import excutils
|
from oslo_utils import excutils
|
||||||
|
|
||||||
from vmware_nsxlib._i18n import _LE, _LW
|
|
||||||
from vmware_nsxlib.v3 import exceptions
|
from vmware_nsxlib.v3 import exceptions
|
||||||
from vmware_nsxlib.v3 import nsx_constants as consts
|
from vmware_nsxlib.v3 import nsx_constants as consts
|
||||||
from vmware_nsxlib.v3 import utils
|
from vmware_nsxlib.v3 import utils
|
||||||
@ -89,7 +88,7 @@ class NsxLibNsGroup(utils.NsxLibApiBase):
|
|||||||
sg_id=nsgroup_id)
|
sg_id=nsgroup_id)
|
||||||
except exceptions.ResourceNotFound:
|
except exceptions.ResourceNotFound:
|
||||||
with excutils.save_and_reraise_exception():
|
with excutils.save_and_reraise_exception():
|
||||||
LOG.error(_LE("NSGroup %s doesn't exists"), nsgroup_id)
|
LOG.error("NSGroup %s doesn't exists", nsgroup_id)
|
||||||
for nsgroup_id in removed:
|
for nsgroup_id in removed:
|
||||||
self.remove_member(
|
self.remove_member(
|
||||||
nsgroup_id, consts.TARGET_TYPE_LOGICAL_PORT, lport_id)
|
nsgroup_id, consts.TARGET_TYPE_LOGICAL_PORT, lport_id)
|
||||||
@ -183,8 +182,8 @@ class NsxLibNsGroup(utils.NsxLibApiBase):
|
|||||||
except exceptions.ManagerError:
|
except exceptions.ManagerError:
|
||||||
# REVISIT(roeyc): A ManagerError might have been raised for a
|
# REVISIT(roeyc): A ManagerError might have been raised for a
|
||||||
# different reason, e.g - NSGroup does not exists.
|
# different reason, e.g - NSGroup does not exists.
|
||||||
LOG.warning(_LW("Failed to add %(target_type)s resources "
|
LOG.warning("Failed to add %(target_type)s resources "
|
||||||
"(%(target_ids)s) to NSGroup %(nsgroup_id)s"),
|
"(%(target_ids)s) to NSGroup %(nsgroup_id)s",
|
||||||
{'target_type': target_type,
|
{'target_type': target_type,
|
||||||
'target_ids': target_ids,
|
'target_ids': target_ids,
|
||||||
'nsgroup_id': nsgroup_id})
|
'nsgroup_id': nsgroup_id})
|
||||||
|
Loading…
Reference in New Issue
Block a user