Merge "Drop log translations"

This commit is contained in:
Jenkins 2017-03-27 18:16:37 +00:00 committed by Gerrit Code Review
commit 5d3a7a113a
10 changed files with 50 additions and 63 deletions

View File

@ -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
# E129 visually indented line with same indent as next logical line
# N530 direct neutron imports not allowed
ignore = N530,E125,E129
# N531 translations hints
ignore = N530,E125,E129,N531
show-source = true
builtins = _
exclude = build,dist

View File

@ -28,16 +28,6 @@ _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)

View File

@ -15,7 +15,7 @@
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 cluster
from vmware_nsxlib.v3 import exceptions
@ -389,9 +389,9 @@ class NsxLibLogicalRouter(utils.NsxLibApiBase):
matched_num = matched_num + 1
if matched_num == 0:
if skip_not_found:
LOG.warning(_LW("No resource in %(res)s matched for values: "
"%(values)s"), {'res': resource,
'values': kwargs})
LOG.warning("No resource in %(res)s matched for values: "
"%(values)s", {'res': resource,
'values': kwargs})
else:
err_msg = (_("No resource in %(res)s matched for values: "
"%(values)s") % {'res': resource,
@ -400,10 +400,10 @@ class NsxLibLogicalRouter(utils.NsxLibApiBase):
manager=self.cluster.nsx_api_managers,
operation=err_msg)
elif matched_num > 1:
LOG.warning(_LW("%(num)s resources in %(res)s matched for values: "
"%(values)s"), {'num': matched_num,
'res': resource,
'values': kwargs})
LOG.warning("%(num)s resources in %(res)s matched for values: "
"%(values)s", {'num': matched_num,
'res': resource,
'values': kwargs})
def add_nat_rule(self, logical_router_id, action, translated_network,
source_net=None, dest_net=None,

View File

@ -18,7 +18,7 @@ import six.moves.urllib.parse as urlparse
from oslo_log import log
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 utils
@ -119,9 +119,9 @@ class RESTClient(object):
def _validate_result(self, result, expected, operation):
if result.status_code not in expected:
result_msg = result.json() if result.content else ''
LOG.warning(_LW("The HTTP request returned error code "
"%(result)s, whereas %(expected)s response "
"codes were expected. Response body %(body)s"),
LOG.warning("The HTTP request returned error code "
"%(result)s, whereas %(expected)s response "
"codes were expected. Response body %(body)s",
{'result': result.status_code,
'expected': '/'.join([str(code)
for code in expected]),

View File

@ -21,7 +21,7 @@ import uuid
from neutron_lib import exceptions
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
LOG = log.getLogger(__name__)
@ -177,13 +177,13 @@ class ClientCertificateManager(object):
self._nsx_trust_management.delete_cert_and_identity(
self._identity, cert_pem)
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
try:
self._storage_driver.delete_cert(self._identity)
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
self._cert = None

View File

@ -31,7 +31,7 @@ from oslo_log import log
from oslo_service import loopingcall
from requests import adapters
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 exceptions
@ -117,7 +117,7 @@ class TimeoutSession(requests.Session):
# This is most probably "client cert not found" error (this
# happens when server closed the connection and requests
# 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:
# Lack of client cert file can come in form of OSError,
# 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):
raise e
# 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
# private key file and dispose it once connections are spawned
@ -262,8 +262,8 @@ class Endpoint(object):
def set_state(self, state):
if self.state != state:
LOG.info(_LI("Endpoint '%(ep)s' changing from state"
" '%(old)s' to '%(new)s'"),
LOG.info("Endpoint '%(ep)s' changing from state"
" '%(old)s' to '%(new)s'",
{'ep': self.provider,
'old': self.state,
'new': state})
@ -411,15 +411,15 @@ class ClusteredAPI(object):
self._http_provider.validate_connection(self, endpoint, conn)
endpoint.set_state(EndpointState.UP)
except exceptions.ClientCertificateNotTrusted:
LOG.warning(_LW("Failed to validate API cluster endpoint "
"'%(ep)s' due to untrusted client certificate"),
LOG.warning("Failed to validate API cluster endpoint "
"'%(ep)s' due to untrusted client certificate",
{'ep': endpoint})
# regenerate connection pool based on new certificate
endpoint.regenerate_pool()
except Exception as e:
endpoint.set_state(EndpointState.DOWN)
LOG.warning(_LW("Failed to validate API cluster endpoint "
"'%(ep)s' due to: %(err)s"),
LOG.warning("Failed to validate API cluster endpoint "
"'%(ep)s' due to: %(err)s",
{'ep': endpoint, 'err': e})
def _select_endpoint(self):
@ -460,8 +460,8 @@ class ClusteredAPI(object):
cluster_id=self.cluster_id)
if endpoint.pool.free() == 0:
LOG.info(_LI("API endpoint %(ep)s at connection "
"capacity %(max)s and has %(waiting)s waiting"),
LOG.info("API endpoint %(ep)s at connection "
"capacity %(max)s and has %(waiting)s waiting",
{'ep': endpoint,
'max': endpoint.pool.max_size,
'waiting': endpoint.pool.waiting()})
@ -496,7 +496,7 @@ class ClusteredAPI(object):
return response
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):
# only trap and retry connection errors
raise e
@ -541,8 +541,8 @@ class NSXClusteredAPI(ClusteredAPI):
provider_index += 1
conf_url = _schemed_url(conf_url)
if conf_url in urls:
LOG.warning(_LW("'%s' already defined in configuration file. "
"Skipping."), urlparse.urlunparse(conf_url))
LOG.warning("'%s' already defined in configuration file. "
"Skipping.", urlparse.urlunparse(conf_url))
continue
urls.append(conf_url)
providers.append(

View File

@ -16,9 +16,6 @@
from oslo_log import log
from oslo_log import versionutils
from vmware_nsxlib._i18n import _LW
LOG = log.getLogger(__name__)
@ -118,8 +115,8 @@ class NsxLibConfig(object):
# this is deprecated, and never used.
versionutils.report_deprecated_feature(
LOG,
_LW('dhcp_profile_uuid is not used by the nsxlib, and will '
'be removed from its configuration in the future.'))
'dhcp_profile_uuid is not used by the nsxlib, and will '
'be removed from its configuration in the future.')
def _attribute_by_index(self, scalar_or_list, index):
if isinstance(scalar_or_list, list):

View File

@ -19,7 +19,7 @@ import uuid
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 nsx_constants as consts
@ -72,16 +72,16 @@ class NSGroupManager(object):
if nested_groups:
size = max(requested_size, max(nested_groups) + 1)
if size > requested_size:
LOG.warning(_LW("Lowering the value of "
"nsx_v3:number_of_nested_groups isn't "
"supported, '%s' nested-groups will be used."),
LOG.warning("Lowering the value of "
"nsx_v3:number_of_nested_groups isn't "
"supported, '%s' nested-groups will be used.",
size)
absent_groups = set(range(size)) - set(nested_groups.keys())
if absent_groups:
LOG.warning(
_LW("Found %(num_present)s Nested Groups, "
"creating %(num_absent)s more."),
"Found %(num_present)s Nested Groups, "
"creating %(num_absent)s more.",
{'num_present': len(nested_groups),
'num_absent': len(absent_groups)})
for i in absent_groups:
@ -139,11 +139,11 @@ class NSGroupManager(object):
nsgroup_id, verify=True)
break
except exceptions.NSGroupMemberNotFound:
LOG.warning(_LW("NSGroup %(nsgroup)s was expected to be found "
"in group %(group_id)s, but wasn't. "
"Looking in the next group.."),
LOG.warning("NSGroup %(nsgroup)s was expected to be found "
"in group %(group_id)s, but wasn't. "
"Looking in the next group..",
{'nsgroup': nsgroup_id, 'group_id': group})
continue
else:
LOG.warning(_LW("NSGroup %s was marked for removal, but its "
"reference is missing."), nsgroup_id)
LOG.warning("NSGroup %s was marked for removal, but its "
"reference is missing.", nsgroup_id)

View File

@ -21,7 +21,7 @@ import copy
from neutron_lib import exceptions as n_exc
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 nsx_constants
from vmware_nsxlib.v3 import utils
@ -102,8 +102,8 @@ class RouterLib(object):
tier1_link_port = (
self._router_port_client.get_tier1_link_port(tier1_uuid))
except exceptions.ResourceNotFound:
LOG.warning(_LW("Logical router link port for tier1 router: %s "
"not found at the backend"), tier1_uuid)
LOG.warning("Logical router link port for tier1 router: %s "
"not found at the backend", tier1_uuid)
return
tier1_link_port_id = tier1_link_port['id']
tier0_link_port_id = (

View File

@ -22,7 +22,6 @@ from neutron_lib import constants
from oslo_log import log
from oslo_utils import excutils
from vmware_nsxlib._i18n import _LE, _LW
from vmware_nsxlib.v3 import exceptions
from vmware_nsxlib.v3 import nsx_constants as consts
from vmware_nsxlib.v3 import utils
@ -89,7 +88,7 @@ class NsxLibNsGroup(utils.NsxLibApiBase):
sg_id=nsgroup_id)
except exceptions.ResourceNotFound:
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:
self.remove_member(
nsgroup_id, consts.TARGET_TYPE_LOGICAL_PORT, lport_id)
@ -183,8 +182,8 @@ class NsxLibNsGroup(utils.NsxLibApiBase):
except exceptions.ManagerError:
# REVISIT(roeyc): A ManagerError might have been raised for a
# different reason, e.g - NSGroup does not exists.
LOG.warning(_LW("Failed to add %(target_type)s resources "
"(%(target_ids)s) to NSGroup %(nsgroup_id)s"),
LOG.warning("Failed to add %(target_type)s resources "
"(%(target_ids)s) to NSGroup %(nsgroup_id)s",
{'target_type': target_type,
'target_ids': target_ids,
'nsgroup_id': nsgroup_id})