Remove log translations from neutron-lbaas
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: Ia323fc58c66c645fca0254ace01a8849ce239525
This commit is contained in:
parent
659d222d45
commit
e44ef6d95f
|
@ -27,16 +27,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)
|
||||
|
|
|
@ -26,7 +26,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._i18n import _
|
||||
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
|
||||
|
@ -123,7 +123,7 @@ class LbaasAgentManager(periodic_task.PeriodicTasks):
|
|||
self.state_rpc.report_state(self.context, self.agent_state)
|
||||
self.agent_state.pop('start_flag', None)
|
||||
except Exception:
|
||||
LOG.exception(_LE("Failed reporting state!"))
|
||||
LOG.exception("Failed reporting state!")
|
||||
|
||||
def initialize_service_hook(self, started_by):
|
||||
self.sync_state()
|
||||
|
@ -144,8 +144,7 @@ class LbaasAgentManager(periodic_task.PeriodicTasks):
|
|||
self.plugin_rpc.update_loadbalancer_stats(
|
||||
loadbalancer_id, stats)
|
||||
except Exception:
|
||||
LOG.exception(_LE('Error updating statistics on loadbalancer'
|
||||
' %s'),
|
||||
LOG.exception('Error updating statistics on loadbalancer %s',
|
||||
loadbalancer_id)
|
||||
self.needs_resync = True
|
||||
|
||||
|
@ -161,7 +160,7 @@ class LbaasAgentManager(periodic_task.PeriodicTasks):
|
|||
self._reload_loadbalancer(loadbalancer_id)
|
||||
|
||||
except Exception:
|
||||
LOG.exception(_LE('Unable to retrieve ready devices'))
|
||||
LOG.exception('Unable to retrieve ready devices')
|
||||
self.needs_resync = True
|
||||
|
||||
self.remove_orphans()
|
||||
|
@ -181,7 +180,7 @@ class LbaasAgentManager(periodic_task.PeriodicTasks):
|
|||
loadbalancer_dict)
|
||||
driver_name = loadbalancer.provider.device_driver
|
||||
if driver_name not in self.device_drivers:
|
||||
LOG.error(_LE('No device driver on agent: %s.'), driver_name)
|
||||
LOG.error('No device driver on agent: %s.', driver_name)
|
||||
self.plugin_rpc.update_status(
|
||||
'loadbalancer', loadbalancer_id, constants.ERROR)
|
||||
return
|
||||
|
@ -190,8 +189,7 @@ class LbaasAgentManager(periodic_task.PeriodicTasks):
|
|||
self.instance_mapping[loadbalancer_id] = driver_name
|
||||
self.plugin_rpc.loadbalancer_deployed(loadbalancer_id)
|
||||
except Exception:
|
||||
LOG.exception(_LE('Unable to deploy instance for '
|
||||
'loadbalancer: %s'),
|
||||
LOG.exception('Unable to deploy instance for loadbalancer: %s',
|
||||
loadbalancer_id)
|
||||
self.needs_resync = True
|
||||
|
||||
|
@ -202,7 +200,7 @@ class LbaasAgentManager(periodic_task.PeriodicTasks):
|
|||
del self.instance_mapping[lb_id]
|
||||
self.plugin_rpc.loadbalancer_destroyed(lb_id)
|
||||
except Exception:
|
||||
LOG.exception(_LE('Unable to destroy device for loadbalancer: %s'),
|
||||
LOG.exception('Unable to destroy device for loadbalancer: %s',
|
||||
lb_id)
|
||||
self.needs_resync = True
|
||||
|
||||
|
@ -217,8 +215,8 @@ class LbaasAgentManager(periodic_task.PeriodicTasks):
|
|||
|
||||
def _handle_failed_driver_call(self, operation, obj, driver):
|
||||
obj_type = obj.__class__.__name__.lower()
|
||||
LOG.exception(_LE('%(operation)s %(obj)s %(id)s failed on device '
|
||||
'driver %(driver)s'),
|
||||
LOG.exception('%(operation)s %(obj)s %(id)s failed on device '
|
||||
'driver %(driver)s',
|
||||
{'operation': operation.capitalize(), 'obj': obj_type,
|
||||
'id': obj.id, 'driver': driver})
|
||||
self._update_statuses(obj, error=True)
|
||||
|
@ -232,10 +230,10 @@ class LbaasAgentManager(periodic_task.PeriodicTasks):
|
|||
else:
|
||||
# Copy keys since the dictionary is modified in the loop body
|
||||
for loadbalancer_id in list(self.instance_mapping.keys()):
|
||||
LOG.info(_LI("Destroying loadbalancer %s due to agent "
|
||||
"disabling"), loadbalancer_id)
|
||||
LOG.info("Destroying loadbalancer %s due to agent "
|
||||
"disabling", loadbalancer_id)
|
||||
self._destroy_loadbalancer(loadbalancer_id)
|
||||
LOG.info(_LI("Agent_updated by server side %s!"), payload)
|
||||
LOG.info("Agent_updated by server side %s!", payload)
|
||||
|
||||
def _update_statuses(self, obj, error=False):
|
||||
lb_p_status = constants.ACTIVE
|
||||
|
@ -266,7 +264,7 @@ class LbaasAgentManager(periodic_task.PeriodicTasks):
|
|||
def create_loadbalancer(self, context, loadbalancer, driver_name):
|
||||
loadbalancer = data_models.LoadBalancer.from_dict(loadbalancer)
|
||||
if driver_name not in self.device_drivers:
|
||||
LOG.error(_LE('No device driver on agent: %s.'), driver_name)
|
||||
LOG.error('No device driver on agent: %s.', driver_name)
|
||||
self.plugin_rpc.update_status('loadbalancer', loadbalancer.id,
|
||||
provisioning_status=constants.ERROR)
|
||||
return
|
||||
|
|
|
@ -23,7 +23,6 @@ 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
|
||||
|
||||
|
@ -133,14 +132,14 @@ class ChanceScheduler(object):
|
|||
active_agents = plugin.db.get_lbaas_agents(context, active=True)
|
||||
if not active_agents:
|
||||
LOG.warning(
|
||||
_LW('No active lbaas agents for load balancer %s'),
|
||||
'No active lbaas agents for load balancer %s',
|
||||
loadbalancer.id)
|
||||
return
|
||||
|
||||
candidates = plugin.db.get_lbaas_agent_candidates(device_driver,
|
||||
active_agents)
|
||||
if not candidates:
|
||||
LOG.warning(_LW('No lbaas agent supporting device driver %s'),
|
||||
LOG.warning('No lbaas agent supporting device driver %s',
|
||||
device_driver)
|
||||
return
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ from oslo_config import cfg
|
|||
from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
|
||||
from neutron_lbaas._i18n import _LE
|
||||
from neutron_lbaas.common.cert_manager.barbican_auth import common
|
||||
from neutron_lbaas.common import keystone
|
||||
|
||||
|
@ -44,5 +43,5 @@ class BarbicanACLAuth(common.BarbicanAuth):
|
|||
)
|
||||
except Exception:
|
||||
with excutils.save_and_reraise_exception():
|
||||
LOG.exception(_LE("Error creating Barbican client"))
|
||||
LOG.exception("Error creating Barbican client")
|
||||
return cls._barbican_client
|
||||
|
|
|
@ -18,7 +18,7 @@ from oslo_log import log as logging
|
|||
from oslo_utils import excutils
|
||||
from stevedore import driver as stevedore_driver
|
||||
|
||||
from neutron_lbaas._i18n import _LI, _LW, _LE
|
||||
from neutron_lbaas._i18n import _
|
||||
from neutron_lbaas.common.cert_manager import cert_manager
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -32,7 +32,7 @@ class Cert(cert_manager.Cert):
|
|||
def __init__(self, cert_container):
|
||||
if not isinstance(cert_container,
|
||||
barbican_client.containers.CertificateContainer):
|
||||
raise TypeError(_LE(
|
||||
raise TypeError(_(
|
||||
"Retrieved Barbican Container is not of the correct type "
|
||||
"(certificate)."))
|
||||
self._cert_container = cert_container
|
||||
|
@ -86,7 +86,7 @@ class CertManager(cert_manager.CertManager):
|
|||
|
||||
connection = self.auth.get_barbican_client(project_id)
|
||||
|
||||
LOG.info(_LI(
|
||||
LOG.info((
|
||||
"Storing certificate container '{0}' in Barbican."
|
||||
).format(name))
|
||||
|
||||
|
@ -139,16 +139,16 @@ class CertManager(cert_manager.CertManager):
|
|||
old_ref = secret.secret_ref
|
||||
try:
|
||||
secret.delete()
|
||||
LOG.info(_LI(
|
||||
LOG.info((
|
||||
"Deleted secret {0} ({1}) during rollback."
|
||||
).format(secret.name, old_ref))
|
||||
except Exception:
|
||||
LOG.warning(_LW(
|
||||
LOG.warning((
|
||||
"Failed to delete {0} ({1}) during rollback. This "
|
||||
"is probably not a problem."
|
||||
).format(secret.name, old_ref))
|
||||
with excutils.save_and_reraise_exception():
|
||||
LOG.exception(_LE("Error storing certificate data"))
|
||||
LOG.exception("Error storing certificate data")
|
||||
|
||||
def get_cert(self, project_id, cert_ref, resource_ref,
|
||||
check_only=False, service_name='lbaas'):
|
||||
|
@ -165,7 +165,7 @@ class CertManager(cert_manager.CertManager):
|
|||
"""
|
||||
connection = self.auth.get_barbican_client(project_id)
|
||||
|
||||
LOG.info(_LI(
|
||||
LOG.info((
|
||||
"Loading certificate container {0} from Barbican."
|
||||
).format(cert_ref))
|
||||
try:
|
||||
|
@ -182,7 +182,7 @@ class CertManager(cert_manager.CertManager):
|
|||
return Cert(cert_container)
|
||||
except Exception:
|
||||
with excutils.save_and_reraise_exception():
|
||||
LOG.exception(_LE("Error getting {0}").format(cert_ref))
|
||||
LOG.exception("Error getting {0}".format(cert_ref))
|
||||
|
||||
def delete_cert(self, project_id, cert_ref, resource_ref,
|
||||
service_name='lbaas'):
|
||||
|
@ -196,7 +196,7 @@ class CertManager(cert_manager.CertManager):
|
|||
"""
|
||||
connection = self.auth.get_barbican_client(project_id)
|
||||
|
||||
LOG.info(_LI(
|
||||
LOG.info((
|
||||
"Deregistering as a consumer of {0} in Barbican."
|
||||
).format(cert_ref))
|
||||
try:
|
||||
|
@ -207,6 +207,6 @@ class CertManager(cert_manager.CertManager):
|
|||
)
|
||||
except Exception:
|
||||
with excutils.save_and_reraise_exception():
|
||||
LOG.exception(_LE(
|
||||
LOG.exception((
|
||||
"Error deregistering as a consumer of {0}"
|
||||
).format(cert_ref))
|
||||
|
|
|
@ -18,7 +18,6 @@ from oslo_config import cfg
|
|||
from oslo_log import log as logging
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
from neutron_lbaas._i18n import _LI, _LE
|
||||
from neutron_lbaas.common.cert_manager import cert_manager
|
||||
from neutron_lbaas.common import exceptions
|
||||
|
||||
|
@ -85,9 +84,7 @@ class CertManager(cert_manager.CertManager):
|
|||
cert_ref = uuidutils.generate_uuid()
|
||||
filename_base = os.path.join(CONF.certificates.storage_path, cert_ref)
|
||||
|
||||
LOG.info(_LI(
|
||||
"Storing certificate data on the local filesystem."
|
||||
))
|
||||
LOG.info("Storing certificate data on the local filesystem.")
|
||||
try:
|
||||
filename_certificate = "{0}.crt".format(filename_base)
|
||||
with open(filename_certificate, 'w') as cert_file:
|
||||
|
@ -107,7 +104,7 @@ class CertManager(cert_manager.CertManager):
|
|||
with open(filename_pkp, 'w') as pass_file:
|
||||
pass_file.write(private_key_passphrase)
|
||||
except IOError as ioe:
|
||||
LOG.error(_LE("Failed to store certificate."))
|
||||
LOG.error("Failed to store certificate.")
|
||||
raise exceptions.CertificateStorageException(message=ioe.message)
|
||||
|
||||
return cert_ref
|
||||
|
@ -123,7 +120,7 @@ class CertManager(cert_manager.CertManager):
|
|||
representation of the certificate data
|
||||
:raises CertificateStorageException: if certificate retrieval fails
|
||||
"""
|
||||
LOG.info(_LI(
|
||||
LOG.info((
|
||||
"Loading certificate {0} from the local filesystem."
|
||||
).format(cert_ref))
|
||||
|
||||
|
@ -140,7 +137,7 @@ class CertManager(cert_manager.CertManager):
|
|||
with open(filename_certificate, 'r') as cert_file:
|
||||
cert_data['certificate'] = cert_file.read()
|
||||
except IOError:
|
||||
LOG.error(_LE(
|
||||
LOG.error((
|
||||
"Failed to read certificate for {0}."
|
||||
).format(cert_ref))
|
||||
raise exceptions.CertificateStorageException(
|
||||
|
@ -150,7 +147,7 @@ class CertManager(cert_manager.CertManager):
|
|||
with open(filename_private_key, 'r') as key_file:
|
||||
cert_data['private_key'] = key_file.read()
|
||||
except IOError:
|
||||
LOG.error(_LE(
|
||||
LOG.error((
|
||||
"Failed to read private key for {0}."
|
||||
).format(cert_ref))
|
||||
raise exceptions.CertificateStorageException(
|
||||
|
@ -180,7 +177,7 @@ class CertManager(cert_manager.CertManager):
|
|||
|
||||
:raises CertificateStorageException: if certificate deletion fails
|
||||
"""
|
||||
LOG.info(_LI(
|
||||
LOG.info((
|
||||
"Deleting certificate {0} from the local filesystem."
|
||||
).format(cert_ref))
|
||||
|
||||
|
@ -197,7 +194,7 @@ class CertManager(cert_manager.CertManager):
|
|||
os.remove(filename_intermediates)
|
||||
os.remove(filename_pkp)
|
||||
except IOError as ioe:
|
||||
LOG.error(_LE(
|
||||
LOG.error((
|
||||
"Failed to delete certificate {0}."
|
||||
).format(cert_ref))
|
||||
raise exceptions.CertificateStorageException(message=ioe.message)
|
||||
|
|
|
@ -19,11 +19,11 @@ Neutron Lbaas base exception handling.
|
|||
|
||||
from neutron_lib import exceptions
|
||||
|
||||
from neutron_lbaas._i18n import _LE
|
||||
from neutron_lbaas._i18n import _
|
||||
|
||||
|
||||
class ModelMapException(exceptions.NeutronException):
|
||||
message = _LE("Unable to map model class %(target_name)s")
|
||||
message = _("Unable to map model class %(target_name)s")
|
||||
|
||||
|
||||
class LbaasException(exceptions.NeutronException):
|
||||
|
@ -35,22 +35,22 @@ class TLSException(LbaasException):
|
|||
|
||||
|
||||
class NeedsPassphrase(TLSException):
|
||||
message = _LE("Passphrase needed to decrypt key but client "
|
||||
"did not provide one.")
|
||||
message = _("Passphrase needed to decrypt key but client "
|
||||
"did not provide one.")
|
||||
|
||||
|
||||
class UnreadableCert(TLSException):
|
||||
message = _LE("Could not read X509 from PEM")
|
||||
message = _("Could not read X509 from PEM")
|
||||
|
||||
|
||||
class MisMatchedKey(TLSException):
|
||||
message = _LE("Key and x509 certificate do not match")
|
||||
message = _("Key and x509 certificate do not match")
|
||||
|
||||
|
||||
class CertificateStorageException(TLSException):
|
||||
message = _LE('Could not store certificate: %(msg)s')
|
||||
message = _('Could not store certificate: %(msg)s')
|
||||
|
||||
|
||||
class LoadbalancerReschedulingFailed(exceptions.Conflict):
|
||||
message = _LE("Failed rescheduling loadbalancer %(loadbalancer_id)s: "
|
||||
"no eligible lbaas agent found.")
|
||||
message = _("Failed rescheduling loadbalancer %(loadbalancer_id)s: "
|
||||
"no eligible lbaas agent found.")
|
||||
|
|
|
@ -19,7 +19,7 @@ from oslo_config import cfg
|
|||
from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
|
||||
from neutron_lbaas._i18n import _, _LE
|
||||
from neutron_lbaas._i18n import _
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -119,6 +119,6 @@ def get_session():
|
|||
_SESSION = session.Session(auth=kc, verify=not insecure)
|
||||
except Exception:
|
||||
with excutils.save_and_reraise_exception():
|
||||
LOG.exception(_LE("Error creating Keystone session."))
|
||||
LOG.exception("Error creating Keystone session.")
|
||||
|
||||
return _SESSION
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
from cryptography.hazmat import backends
|
||||
from cryptography.hazmat.primitives import serialization
|
||||
from cryptography import x509
|
||||
from neutron_lbaas._i18n import _LE
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import encodeutils
|
||||
|
||||
|
@ -158,7 +157,7 @@ def get_host_names(certificate):
|
|||
|
||||
return host_names
|
||||
except Exception:
|
||||
LOG.exception(_LE("Unreadable certificate."))
|
||||
LOG.exception("Unreadable certificate.")
|
||||
raise exceptions.UnreadableCert
|
||||
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ from neutron_lib import exceptions as n_exc
|
|||
from oslo_log import log as logging
|
||||
import oslo_messaging as messaging
|
||||
|
||||
from neutron_lbaas._i18n import _, _LW
|
||||
from neutron_lbaas._i18n import _
|
||||
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
|
||||
|
@ -43,8 +43,7 @@ class LoadBalancerCallbacks(object):
|
|||
if not agents:
|
||||
return []
|
||||
elif len(agents) > 1:
|
||||
LOG.warning(_LW('Multiple lbaas agents found on host %s'),
|
||||
host)
|
||||
LOG.warning('Multiple lbaas agents found on host %s', host)
|
||||
loadbalancers = self.plugin.db.list_loadbalancers_on_lbaas_agent(
|
||||
context, agents[0].id)
|
||||
loadbalancer_ids = [
|
||||
|
@ -120,10 +119,10 @@ class LoadBalancerCallbacks(object):
|
|||
def update_status(self, context, obj_type, obj_id,
|
||||
provisioning_status=None, operating_status=None):
|
||||
if not provisioning_status and not operating_status:
|
||||
LOG.warning(_LW('update_status for %(obj_type)s %(obj_id)s called '
|
||||
'without specifying provisioning_status or '
|
||||
'operating_status') % {'obj_type': obj_type,
|
||||
'obj_id': obj_id})
|
||||
LOG.warning('update_status for %(obj_type)s %(obj_id)s called '
|
||||
'without specifying provisioning_status or '
|
||||
'operating_status' % {'obj_type': obj_type,
|
||||
'obj_id': obj_id})
|
||||
return
|
||||
model_mapping = {
|
||||
'loadbalancer': db_models.LoadBalancer,
|
||||
|
@ -142,9 +141,9 @@ class LoadBalancerCallbacks(object):
|
|||
except n_exc.NotFound:
|
||||
# update_status may come from agent on an object which was
|
||||
# already deleted from db with other request
|
||||
LOG.warning(_LW('Cannot update status: %(obj_type)s %(obj_id)s '
|
||||
'not found in the DB, it was probably deleted '
|
||||
'concurrently'),
|
||||
LOG.warning('Cannot update status: %(obj_type)s %(obj_id)s '
|
||||
'not found in the DB, it was probably deleted '
|
||||
'concurrently',
|
||||
{'obj_type': obj_type, 'obj_id': obj_id})
|
||||
|
||||
def loadbalancer_destroyed(self, context, loadbalancer_id=None):
|
||||
|
|
|
@ -27,7 +27,7 @@ from oslo_config import cfg
|
|||
from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
|
||||
from neutron_lbaas._i18n import _, _LI, _LW
|
||||
from neutron_lbaas._i18n import _
|
||||
from neutron_lbaas.agent import agent_device_driver
|
||||
from neutron_lbaas.drivers.haproxy import jinja_cfg
|
||||
from neutron_lbaas.services.loadbalancer import constants as lb_const
|
||||
|
@ -187,7 +187,7 @@ class HaproxyNSDriver(agent_device_driver.AgentDeviceDriver):
|
|||
lb_config = self.plugin_rpc.get_loadbalancer(loadbalancer_id)
|
||||
loadbalancer = data_models.LoadBalancer.from_dict(lb_config)
|
||||
if self._is_active(loadbalancer):
|
||||
LOG.warning(_LW('Stats socket not found for loadbalancer %s'),
|
||||
LOG.warning('Stats socket not found for loadbalancer %s',
|
||||
loadbalancer_id)
|
||||
else:
|
||||
LOG.debug('Stats socket not found for loadbalancer %s,'
|
||||
|
@ -203,7 +203,7 @@ class HaproxyNSDriver(agent_device_driver.AgentDeviceDriver):
|
|||
:returns: True if loadbalancer was deployed, False otherwise
|
||||
"""
|
||||
if not self.deployable(loadbalancer):
|
||||
LOG.info(_LI("Loadbalancer %s is not deployable.") %
|
||||
LOG.info("Loadbalancer %s is not deployable." %
|
||||
loadbalancer.id)
|
||||
return False
|
||||
|
||||
|
@ -266,7 +266,7 @@ class HaproxyNSDriver(agent_device_driver.AgentDeviceDriver):
|
|||
|
||||
return self._parse_stats(raw_stats)
|
||||
except socket.error as e:
|
||||
LOG.warning(_LW('Error while connecting to stats socket: %s'), e)
|
||||
LOG.warning('Error while connecting to stats socket: %s', e)
|
||||
return {}
|
||||
|
||||
def _parse_stats(self, raw_stats):
|
||||
|
|
|
@ -23,7 +23,7 @@ from neutron_lib import constants
|
|||
from neutron_lib import context as ncontext
|
||||
from oslo_service import service
|
||||
|
||||
from neutron_lbaas._i18n import _, _LE
|
||||
from neutron_lbaas._i18n import _
|
||||
from neutron_lbaas.drivers import driver_base
|
||||
from neutron_lbaas.drivers import driver_mixins
|
||||
from neutron_lbaas.services.loadbalancer.drivers.netscaler import ncc_client
|
||||
|
@ -201,7 +201,7 @@ class NetScalerLoadBalancerDriverV2(driver_base.LoadBalancerBaseDriver):
|
|||
self.load_balancer.successful_completion(
|
||||
self.admin_ctx, db_lb, delete=True)
|
||||
except Exception:
|
||||
LOG.error(_LE("error with successful completion"))
|
||||
LOG.error("error with successful completion")
|
||||
PROVISIONING_STATUS_TRACKER.remove(lb_id)
|
||||
return
|
||||
else:
|
||||
|
@ -296,7 +296,7 @@ class NetScalerLoadBalancerDriverV2(driver_base.LoadBalancerBaseDriver):
|
|||
entity_manager.failed_completion(
|
||||
self.admin_ctx, db_entity)
|
||||
except Exception:
|
||||
LOG.error(_LE("error with failed completion"))
|
||||
LOG.error("error with failed completion")
|
||||
return
|
||||
|
||||
if db_entity.provisioning_status == constants.PENDING_DELETE:
|
||||
|
@ -312,7 +312,7 @@ class NetScalerLoadBalancerDriverV2(driver_base.LoadBalancerBaseDriver):
|
|||
entity_manager.successful_completion(
|
||||
self.admin_ctx, db_entity, delete=True)
|
||||
except Exception:
|
||||
LOG.error(_LE("error with successful completion"))
|
||||
LOG.error("error with successful completion")
|
||||
return
|
||||
|
||||
if entity_status[PROV] != constants.ACTIVE:
|
||||
|
@ -325,7 +325,7 @@ class NetScalerLoadBalancerDriverV2(driver_base.LoadBalancerBaseDriver):
|
|||
entity_manager.successful_completion(
|
||||
self.admin_ctx, db_entity)
|
||||
except Exception:
|
||||
LOG.error(_LE("error with successful completion"))
|
||||
LOG.error("error with successful completion")
|
||||
|
||||
return
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
# under the License.
|
||||
|
||||
from neutron_lbaas._i18n import _
|
||||
from neutron_lbaas._i18n import _LI
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging as messaging
|
||||
|
@ -91,7 +90,7 @@ class OctaviaConsumer(service.Service):
|
|||
|
||||
def start(self):
|
||||
super(OctaviaConsumer, self).start()
|
||||
LOG.info(_LI("Starting octavia consumer..."))
|
||||
LOG.info("Starting octavia consumer...")
|
||||
access_policy = dispatcher.DefaultRPCAccessPolicy
|
||||
self.server = messaging.get_rpc_server(self.transport, self.target,
|
||||
self.endpoints,
|
||||
|
@ -101,12 +100,12 @@ class OctaviaConsumer(service.Service):
|
|||
|
||||
def stop(self, graceful=False):
|
||||
if self.server:
|
||||
LOG.info(_LI('Stopping consumer...'))
|
||||
LOG.info('Stopping consumer...')
|
||||
self.server.stop()
|
||||
if graceful:
|
||||
LOG.info(
|
||||
_LI('Consumer successfully stopped. Waiting for final '
|
||||
'messages to be processed...'))
|
||||
('Consumer successfully stopped. Waiting for final '
|
||||
'messages to be processed...'))
|
||||
self.server.wait()
|
||||
super(OctaviaConsumer, self).stop(graceful=graceful)
|
||||
|
||||
|
|
|
@ -13,30 +13,30 @@
|
|||
# under the License.
|
||||
|
||||
|
||||
from neutron_lbaas._i18n import _LE
|
||||
from neutron_lbaas._i18n import _
|
||||
from neutron_lbaas.common import exceptions
|
||||
|
||||
|
||||
class RadwareLBaasV2Exception(exceptions.LbaasException):
|
||||
message = _LE('An unknown exception occurred in '
|
||||
'Radware LBaaS v2 provider.')
|
||||
message = _('An unknown exception occurred in '
|
||||
'Radware LBaaS v2 provider.')
|
||||
|
||||
|
||||
class AuthenticationMissing(RadwareLBaasV2Exception):
|
||||
message = _LE('vDirect user/password missing. '
|
||||
'Specify in configuration file, under [radwarev2] section')
|
||||
message = _('vDirect user/password missing. '
|
||||
'Specify in configuration file, under [radwarev2] section')
|
||||
|
||||
|
||||
class WorkflowTemplateMissing(RadwareLBaasV2Exception):
|
||||
message = _LE('Workflow template %(workflow_template)s is missing '
|
||||
'on vDirect server. Upload missing workflow')
|
||||
message = _('Workflow template %(workflow_template)s is missing '
|
||||
'on vDirect server. Upload missing workflow')
|
||||
|
||||
|
||||
class RESTRequestFailure(RadwareLBaasV2Exception):
|
||||
message = _LE('REST request failed with status %(status)s. '
|
||||
'Reason: %(reason)s, Description: %(description)s. '
|
||||
'Success status codes are %(success_codes)s')
|
||||
message = _('REST request failed with status %(status)s. '
|
||||
'Reason: %(reason)s, Description: %(description)s. '
|
||||
'Success status codes are %(success_codes)s')
|
||||
|
||||
|
||||
class UnsupportedEntityOperation(RadwareLBaasV2Exception):
|
||||
message = _LE('%(operation)s operation is not supported for %(entity)s.')
|
||||
message = _('%(operation)s operation is not supported for %(entity)s.')
|
||||
|
|
|
@ -18,7 +18,6 @@ from oslo_serialization import base64
|
|||
from oslo_serialization import jsonutils
|
||||
from six.moves import http_client
|
||||
|
||||
from neutron_lbaas._i18n import _LE, _LW
|
||||
from neutron_lbaas.drivers.radware import exceptions as r_exc
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -63,10 +62,9 @@ class vDirectRESTClient(object):
|
|||
'ssl=%(ssl)r', debug_params)
|
||||
|
||||
def _flip_servers(self):
|
||||
LOG.warning(_LW('Flipping servers. Current is: %(server)s, '
|
||||
'switching to %(secondary)s'),
|
||||
{'server': self.server,
|
||||
'secondary': self.secondary_server})
|
||||
LOG.warning('Flipping servers. Current is: %(server)s, switching to '
|
||||
'%(secondary)s', {'server': self.server,
|
||||
'secondary': self.secondary_server})
|
||||
self.server, self.secondary_server = self.secondary_server, self.server
|
||||
|
||||
def _recover(self, action, resource, data, headers, binary=False):
|
||||
|
@ -76,19 +74,19 @@ class vDirectRESTClient(object):
|
|||
headers, binary)
|
||||
return resp
|
||||
else:
|
||||
LOG.error(_LE('REST client is not able to recover '
|
||||
'since only one vDirect server is '
|
||||
'configured.'))
|
||||
LOG.error('REST client is not able to recover '
|
||||
'since only one vDirect server is '
|
||||
'configured.')
|
||||
return -1, None, None, None
|
||||
|
||||
def call(self, action, resource, data, headers, binary=False):
|
||||
resp = self._call(action, resource, data, headers, binary)
|
||||
if resp[RESP_STATUS] == -1:
|
||||
LOG.warning(_LW('vDirect server is not responding (%s).'),
|
||||
LOG.warning('vDirect server is not responding (%s).',
|
||||
self.server)
|
||||
return self._recover(action, resource, data, headers, binary)
|
||||
elif resp[RESP_STATUS] in (301, 307):
|
||||
LOG.warning(_LW('vDirect server is not active (%s).'),
|
||||
LOG.warning('vDirect server is not active (%s).',
|
||||
self.server)
|
||||
return self._recover(action, resource, data, headers, binary)
|
||||
else:
|
||||
|
@ -116,15 +114,15 @@ class vDirectRESTClient(object):
|
|||
conn = http_client.HTTPSConnection(
|
||||
self.server, self.port, timeout=self.timeout)
|
||||
if conn is None:
|
||||
LOG.error(_LE('vdirectRESTClient: Could not establish HTTPS '
|
||||
'connection'))
|
||||
LOG.error('vdirectRESTClient: Could not establish HTTPS '
|
||||
'connection')
|
||||
return 0, None, None, None
|
||||
else:
|
||||
conn = http_client.HTTPConnection(
|
||||
self.server, self.port, timeout=self.timeout)
|
||||
if conn is None:
|
||||
LOG.error(_LE('vdirectRESTClient: Could not establish HTTP '
|
||||
'connection'))
|
||||
LOG.error('vdirectRESTClient: Could not establish HTTP '
|
||||
'connection')
|
||||
return 0, None, None, None
|
||||
|
||||
try:
|
||||
|
@ -140,7 +138,7 @@ class vDirectRESTClient(object):
|
|||
ret = (response.status, response.reason, respstr, respdata)
|
||||
except Exception as e:
|
||||
log_dict = {'action': action, 'e': e}
|
||||
LOG.error(_LE('vdirectRESTClient: %(action)s failure, %(e)r'),
|
||||
LOG.error('vdirectRESTClient: %(action)s failure, %(e)r',
|
||||
log_dict)
|
||||
ret = -1, None, None, None
|
||||
conn.close()
|
||||
|
|
|
@ -26,7 +26,6 @@ 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
|
||||
|
@ -147,7 +146,7 @@ class RadwareLBaaSV2Driver(base_v2_driver.RadwareLBaaSBaseV2Driver):
|
|||
|
||||
def _start_completion_handling_thread(self):
|
||||
if not self.completion_handler_started:
|
||||
LOG.info(_LI('Starting operation completion handling thread'))
|
||||
LOG.info('Starting operation completion handling thread')
|
||||
self.completion_handler.start()
|
||||
self.completion_handler_started = True
|
||||
|
||||
|
@ -308,8 +307,7 @@ class RadwareLBaaSV2Driver(base_v2_driver.RadwareLBaaSBaseV2Driver):
|
|||
LOG.debug('Proxy port for LB %s was deleted', lb.id)
|
||||
except Exception:
|
||||
with excutils.save_and_reraise_exception():
|
||||
LOG.error(_LE('Proxy port deletion for LB %s '
|
||||
'failed'), lb.id)
|
||||
LOG.error('Proxy port deletion for LB %s failed', lb.id)
|
||||
manager.successful_completion(ctx, lb, delete=True)
|
||||
else:
|
||||
oper = OperationAttributes(
|
||||
|
@ -481,8 +479,8 @@ class RadwareLBaaSV2Driver(base_v2_driver.RadwareLBaaSBaseV2Driver):
|
|||
"""
|
||||
proxy_port = self._get_proxy_port(ctx, lb)
|
||||
if proxy_port:
|
||||
LOG.info(_LI('LB %(lb_id)s proxy port exists on subnet \
|
||||
%(subnet_id)s with ip address %(ip_address)s') %
|
||||
LOG.info('LB %(lb_id)s proxy port exists on subnet '
|
||||
'%(subnet_id)s with ip address %(ip_address)s' %
|
||||
{'lb_id': lb.id, 'subnet_id': proxy_port['subnet_id'],
|
||||
'ip_address': proxy_port['ip_address']})
|
||||
return proxy_port
|
||||
|
@ -504,8 +502,8 @@ class RadwareLBaaSV2Driver(base_v2_driver.RadwareLBaaSBaseV2Driver):
|
|||
ctx, {'port': proxy_port_data})
|
||||
proxy_port_ip_data = proxy_port['fixed_ips'][0]
|
||||
|
||||
LOG.info(_LI('LB %(lb_id)s proxy port created on subnet %(subnet_id)s \
|
||||
with ip address %(ip_address)s') %
|
||||
LOG.info('LB %(lb_id)s proxy port created on subnet %(subnet_id)s '
|
||||
'with ip address %(ip_address)s' %
|
||||
{'lb_id': lb.id, 'subnet_id': proxy_port_ip_data['subnet_id'],
|
||||
'ip_address': proxy_port_ip_data['ip_address']})
|
||||
|
||||
|
@ -530,8 +528,8 @@ class RadwareLBaaSV2Driver(base_v2_driver.RadwareLBaaSBaseV2Driver):
|
|||
proxy_port = ports[0]
|
||||
proxy_port_ip_data = proxy_port['fixed_ips'][0]
|
||||
try:
|
||||
LOG.info(_LI('Deleting LB %(lb_id)s proxy port on subnet \
|
||||
%(subnet_id)s with ip address %(ip_address)s') %
|
||||
LOG.info('Deleting LB %(lb_id)s proxy port on subnet '
|
||||
'%(subnet_id)s with ip address %(ip_address)s' %
|
||||
{'lb_id': lb.id,
|
||||
'subnet_id': proxy_port_ip_data['subnet_id'],
|
||||
'ip_address': proxy_port_ip_data['ip_address']})
|
||||
|
@ -541,7 +539,7 @@ class RadwareLBaaSV2Driver(base_v2_driver.RadwareLBaaSBaseV2Driver):
|
|||
except Exception as exception:
|
||||
# stop exception propagation, nport may have
|
||||
# been deleted by other means
|
||||
LOG.warning(_LW('Proxy port deletion failed: %r'),
|
||||
LOG.warning('Proxy port deletion failed: %r',
|
||||
exception)
|
||||
|
||||
def _accomplish_member_static_route_data(self,
|
||||
|
@ -611,8 +609,8 @@ class OperationCompletionHandler(threading.Thread):
|
|||
else:
|
||||
msg = "unknown"
|
||||
error_params = {"operation": oper, "msg": msg}
|
||||
LOG.error(_LE(
|
||||
'Operation %(operation)s failed. Reason: %(msg)s'),
|
||||
LOG.error(
|
||||
'Operation %(operation)s failed. Reason: %(msg)s',
|
||||
error_params)
|
||||
oper.status = n_constants.ERROR
|
||||
OperationCompletionHandler._run_post_failure_function(oper)
|
||||
|
@ -653,8 +651,8 @@ class OperationCompletionHandler(threading.Thread):
|
|||
except Queue.Empty:
|
||||
continue
|
||||
except Exception:
|
||||
LOG.error(_LE(
|
||||
"Exception was thrown inside OperationCompletionHandler"))
|
||||
LOG.error(
|
||||
"Exception was thrown inside OperationCompletionHandler")
|
||||
|
||||
@staticmethod
|
||||
def _run_post_success_function(oper):
|
||||
|
@ -669,8 +667,8 @@ class OperationCompletionHandler(threading.Thread):
|
|||
repr(oper))
|
||||
except Exception:
|
||||
with excutils.save_and_reraise_exception():
|
||||
LOG.error(_LE('Post-operation success function failed '
|
||||
'for operation %s'),
|
||||
LOG.error('Post-operation success function failed '
|
||||
'for operation %s',
|
||||
repr(oper))
|
||||
|
||||
@staticmethod
|
||||
|
@ -683,8 +681,8 @@ class OperationCompletionHandler(threading.Thread):
|
|||
repr(oper))
|
||||
except Exception:
|
||||
with excutils.save_and_reraise_exception():
|
||||
LOG.error(_LE('Post-operation failure function failed '
|
||||
'for operation %s'),
|
||||
LOG.error('Post-operation failure function failed '
|
||||
'for operation %s',
|
||||
repr(oper))
|
||||
|
||||
|
||||
|
|
|
@ -33,7 +33,6 @@ from neutron_lib.plugins import constants
|
|||
from oslo_log import log as logging
|
||||
from oslo_utils import encodeutils
|
||||
|
||||
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
|
||||
|
@ -127,8 +126,8 @@ class LoadBalancerPluginv2(loadbalancerv2.LoadBalancerPluginBaseV2,
|
|||
if lb.provider.provider_name not in provider_names])
|
||||
# resources are left without provider - stop the service
|
||||
if lost_providers:
|
||||
msg = _LE("Delete associated load balancers before "
|
||||
"removing providers %s") % list(lost_providers)
|
||||
msg = ("Delete associated load balancers before "
|
||||
"removing providers %s") % list(lost_providers)
|
||||
LOG.error(msg)
|
||||
raise SystemExit(1)
|
||||
|
||||
|
@ -137,8 +136,8 @@ class LoadBalancerPluginv2(loadbalancerv2.LoadBalancerPluginBaseV2,
|
|||
return self.drivers[provider]
|
||||
except KeyError:
|
||||
# raise if not associated (should never be reached)
|
||||
raise n_exc.Invalid(_LE("Error retrieving driver for provider "
|
||||
"%s") % provider)
|
||||
raise n_exc.Invalid(_("Error retrieving driver for provider %s") %
|
||||
provider)
|
||||
|
||||
def _get_driver_for_loadbalancer(self, context, loadbalancer_id):
|
||||
lb = self.db.get_loadbalancer(context, loadbalancer_id)
|
||||
|
@ -146,8 +145,8 @@ class LoadBalancerPluginv2(loadbalancerv2.LoadBalancerPluginBaseV2,
|
|||
return self.drivers[lb.provider.provider_name]
|
||||
except KeyError:
|
||||
raise n_exc.Invalid(
|
||||
_LE("Error retrieving provider for load balancer. Possible "
|
||||
"providers are %s.") % self.drivers.keys()
|
||||
_("Error retrieving provider for load balancer. Possible "
|
||||
"providers are %s.") % self.drivers.keys()
|
||||
)
|
||||
|
||||
def _get_provider_name(self, entity):
|
||||
|
@ -169,7 +168,7 @@ class LoadBalancerPluginv2(loadbalancerv2.LoadBalancerPluginBaseV2,
|
|||
old_db_entity=None, **kwargs):
|
||||
manager_method = "%s.%s" % (driver_method.__self__.__class__.__name__,
|
||||
driver_method.__name__)
|
||||
LOG.info(_LI("Calling driver operation %s") % manager_method)
|
||||
LOG.info("Calling driver operation %s" % manager_method)
|
||||
try:
|
||||
if old_db_entity:
|
||||
driver_method(context, old_db_entity, db_entity, **kwargs)
|
||||
|
@ -180,7 +179,7 @@ class LoadBalancerPluginv2(loadbalancerv2.LoadBalancerPluginBaseV2,
|
|||
lbaas_agentschedulerv2.NoActiveLbaasAgent) as no_agent:
|
||||
raise no_agent
|
||||
except Exception as e:
|
||||
LOG.exception(_LE("There was an error in the driver"))
|
||||
LOG.exception("There was an error in the driver")
|
||||
self._handle_driver_error(context, db_entity)
|
||||
raise loadbalancerv2.DriverError(msg=e)
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ from tempest import config
|
|||
from tempest.lib.common.utils import test_utils
|
||||
from tempest.lib import exceptions
|
||||
|
||||
from neutron_lbaas._i18n import _, _LI
|
||||
from neutron_lbaas._i18n import _
|
||||
from neutron_lbaas.tests.tempest.v2.clients import health_monitors_client
|
||||
from neutron_lbaas.tests.tempest.v2.clients import listeners_client
|
||||
from neutron_lbaas.tests.tempest.v2.clients import load_balancers_client
|
||||
|
@ -132,12 +132,12 @@ class BaseTestCase(base.BaseNetworkTest):
|
|||
super(BaseTestCase, cls).setUpClass()
|
||||
|
||||
def setUp(cls):
|
||||
cls.LOG.info(_LI('Starting: {0}').format(cls._testMethodName))
|
||||
cls.LOG.info('Starting: {0}'.format(cls._testMethodName))
|
||||
super(BaseTestCase, cls).setUp()
|
||||
|
||||
def tearDown(cls):
|
||||
super(BaseTestCase, cls).tearDown()
|
||||
cls.LOG.info(_LI('Finished: {0}\n').format(cls._testMethodName))
|
||||
cls.LOG.info('Finished: {0}\n'.format(cls._testMethodName))
|
||||
|
||||
@classmethod
|
||||
def _create_load_balancer(cls, wait=True, **lb_kwargs):
|
||||
|
|
3
tox.ini
3
tox.ini
|
@ -49,7 +49,8 @@ commands = python setup.py build_sphinx
|
|||
# N524 contextlib.nested is deprecated
|
||||
# TODO(dougwig) -- uncomment this to test for remaining linkages
|
||||
# N530 direct neutron imports not allowed
|
||||
ignore = E125,E126,E128,E129,E265,H404,H405,N524,N530
|
||||
# N531 Log messages require translation hints
|
||||
ignore = E125,E126,E128,E129,E265,H404,H405,N524,N530,N531
|
||||
show-source = true
|
||||
builtins = _
|
||||
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,tools,.tmp,.ropeproject,rally-scenarios,neutron_lbaas/tests/tempest/lib,neutron_lbaas/tests/tempest/v1/api
|
||||
|
|
Loading…
Reference in New Issue