Fix pep8 failures in gate

Some package must have moved forward recently, causing
the pep8 job to start failing.  Fix the issues since
they're all valid.

Also changed other messages using an exception string
to use str(e) to avoid any possible py3 issues.

Fixes the grenade job to properly build the test server.

Change-Id: I5c98c6d41cc4bce907e09dcb20ede3a9e7268b44
This commit is contained in:
Brian Haley 2020-11-12 13:58:58 -05:00 committed by Michael Johnson
parent 198980639c
commit 57e7bd17bf
26 changed files with 119 additions and 109 deletions

View File

@ -147,7 +147,7 @@ class KeepalivedLvs(udp_listener_base.UdpListenerApiServerBase):
except subprocess.CalledProcessError as e:
LOG.debug('Failed to enable '
'octavia-keepalivedlvs service: '
'%(err)s', {'err': e})
'%(err)s', {'err': str(e)})
return webob.Response(json=dict(
message="Error enabling "
"octavia-keepalivedlvs service",
@ -223,7 +223,7 @@ class KeepalivedLvs(udp_listener_base.UdpListenerApiServerBase):
subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
LOG.debug('Failed to %s keepalivedlvs listener %s',
listener_id + ' : ' + action, e)
listener_id + ' : ' + action, str(e))
return webob.Response(json=dict(
message=("Failed to {0} keepalivedlvs listener {1}"
.format(action, listener_id)),
@ -284,7 +284,7 @@ class KeepalivedLvs(udp_listener_base.UdpListenerApiServerBase):
try:
subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
LOG.error("Failed to stop keepalivedlvs service: %s", e)
LOG.error("Failed to stop keepalivedlvs service: %s", str(e))
return webob.Response(json=dict(
message="Error stopping keepalivedlvs",
details=e.output), status=500)
@ -317,7 +317,7 @@ class KeepalivedLvs(udp_listener_base.UdpListenerApiServerBase):
except subprocess.CalledProcessError as e:
LOG.error("Failed to disable "
"octavia-keepalivedlvs-%(list)s service: "
"%(err)s", {'list': listener_id, 'err': e})
"%(err)s", {'list': listener_id, 'err': str(e)})
return webob.Response(json=dict(
message=(
"Error disabling octavia-keepalivedlvs-"

View File

@ -237,8 +237,8 @@ class Server(object):
CONF.mutate_config_files()
except Exception as e:
LOG.error("Unable to update amphora-agent configuration: "
"{}".format(str(e)))
LOG.error("Unable to update amphora-agent configuration: %s",
str(e))
return webob.Response(json=dict(
message="Unable to update amphora-agent configuration.",
details=str(e)), status=500)

View File

@ -136,10 +136,11 @@ def run_sender(cmd_queue):
else:
LOG.exception('Failed to check keepalived and haproxy status '
'due to exception %s, skipping health '
'heartbeat.', e)
'heartbeat.', str(e))
except Exception as e:
LOG.exception('Failed to check keepalived and haproxy status due '
'to exception %s, skipping health heartbeat.', e)
'to exception %s, skipping health heartbeat.',
str(e))
try:
cmd = cmd_queue.get_nowait()

View File

@ -203,9 +203,9 @@ class HaproxyAmphoraLoadBalancerDriver(
else:
listeners_to_update.append(listener)
except Exception as e:
LOG.exception('Unable to update listener {0} due to '
'"{1}". Skipping this listener.'.format(
listener.id, e))
LOG.exception('Unable to update listener %s due to '
'"%s". Skipping this listener.',
listener.id, str(e))
listener_repo = repo.ListenerRepository()
listener_repo.update(db_apis.get_session(), listener.id,
provisioning_status=consts.ERROR,
@ -588,8 +588,8 @@ class HaproxyAmphoraLoadBalancerDriver(
self.clients[amphora.api_version].update_agent_config(
amphora, agent_config, timeout_dict=timeout_dict)
except exc.NotFound as e:
LOG.debug('Amphora {} does not support the update_agent_config '
'API.'.format(amphora.id))
LOG.debug('Amphora %s does not support the update_agent_config '
'API.', amphora.id)
raise driver_except.AmpDriverNotImplementedError() from e
def get_interface_from_ip(self, amphora, ip_address, timeout_dict=None):

View File

@ -98,7 +98,7 @@ class UDPStatusGetter(object):
except Exception as e:
LOG.warning('Health Manager experienced an exception processing a '
'heartbeat message from %s. Ignoring this packet. '
'Exception: %s', srcaddr, e)
'Exception: %s', srcaddr, str(e))
raise exceptions.InvalidHMACException()
obj['recv_time'] = time.time()
return obj, srcaddr[0]
@ -115,7 +115,7 @@ class UDPStatusGetter(object):
except Exception as e:
LOG.warning('Health Manager experienced an exception processing a '
'heartbeat packet. Ignoring this packet. '
'Exception: %s', e)
'Exception: %s', str(e))
else:
self.health_executor.submit(self.health_updater.update_health,
obj, srcaddr)
@ -241,7 +241,7 @@ class UpdateHealthDb:
except Exception as e:
LOG.exception('Health update for amphora %(amp)s encountered '
'error %(err)s. Skipping health update.',
{'amp': health['id'], 'err': e})
{'amp': health['id'], 'err': str(e)})
# TODO(johnsom) We need to set a warning threshold here
LOG.debug('Health Update finished in: %s seconds',
timeit.default_timer() - start_time)
@ -385,7 +385,7 @@ class UpdateHealthDb:
return
except Exception as e:
LOG.info("Error deleting amp %s with IP %s Error: %s",
health['id'], srcaddr, e)
health['id'], srcaddr, str(e))
expected_listener_count = 0
listeners = health['listeners']

View File

@ -45,6 +45,6 @@ def get_driver(provider):
driver.name = provider
except Exception as e:
LOG.error('Unable to load provider driver %s due to: %s',
provider, e)
provider, str(e))
raise exceptions.ProviderNotFound(prov=provider)
return driver

View File

@ -75,7 +75,7 @@ def call_provider(provider, driver_method, *args, **kwargs):
prov=provider, user_msg=e.user_fault_string)
except Exception as e:
LOG.exception("Provider '%s' raised an unknown error: %s",
provider, e)
provider, str(e))
raise exceptions.ProviderDriverError(prov=provider, user_msg=e)

View File

@ -90,7 +90,7 @@ class BarbicanCertManager(cert_mgr.CertManager):
return certificate_secret.secret_ref
except Exception as e:
with excutils.save_and_reraise_exception():
LOG.error('Error storing certificate data: %s', e)
LOG.error('Error storing certificate data: %s', str(e))
def get_cert(self, context, cert_ref, resource_ref=None, check_only=False,
service_name=None):

View File

@ -113,7 +113,7 @@ class BarbicanCertManager(cert_mgr.CertManager):
'rollback. This might not be a problem.',
i.name, old_ref)
with excutils.save_and_reraise_exception():
LOG.error('Error storing certificate data: %s', e)
LOG.error('Error storing certificate data: %s', str(e))
def get_cert(self, context, cert_ref, resource_ref=None, check_only=False,
service_name=None):
@ -181,7 +181,7 @@ class BarbicanCertManager(cert_mgr.CertManager):
except Exception as e:
with excutils.save_and_reraise_exception():
LOG.error('Error deregistering as a consumer of %s: %s',
cert_ref, e)
cert_ref, str(e))
def set_acls(self, context, cert_ref):
connection = self.auth.get_barbican_client(context.project_id)

View File

@ -48,7 +48,7 @@ def hm_listener(exit_event):
udp_getter.check()
except Exception as e:
LOG.error('Health Manager listener experienced unknown error: %s',
e)
str(e))
LOG.info('Waiting for executor to shutdown...')
udp_getter.health_executor.shutdown()
udp_getter.stats_executor.shutdown()

View File

@ -48,7 +48,7 @@ def spare_amphora_check():
spare_amp.spare_check()
except Exception as e:
LOG.debug('spare_amphora caught the following exception and '
'is restarting: {}'.format(e))
'is restarting: %s', str(e))
spare_amp_thread_event.wait(interval)
@ -70,7 +70,7 @@ def db_cleanup():
db_cleanup.cleanup_load_balancers()
except Exception as e:
LOG.debug('db_cleanup caught the following exception and '
'is restarting: {}'.format(e))
'is restarting: %s', str(e))
db_cleanup_thread_event.wait(interval)
@ -86,7 +86,7 @@ def cert_rotation():
cert_rotate.rotate()
except Exception as e:
LOG.debug('cert_rotation caught the following exception and '
'is restarting: {}'.format(e))
'is restarting: %s', str(e))
cert_rotate_thread_event.wait(interval)

View File

@ -146,7 +146,8 @@ class VirtualMachineManager(compute_base.ComputeBase):
if (CONF.controller_worker.volume_driver !=
constants.VOLUME_NOOP_DRIVER):
self.volume_driver.delete_volume(volume_id)
LOG.exception("Nova failed to build the instance due to: %s", e)
LOG.exception("Nova failed to build the instance due to: %s",
str(e))
raise exceptions.ComputeBuildException(fault=e)
def delete(self, compute_id):
@ -387,7 +388,7 @@ class VirtualMachineManager(compute_base.ComputeBase):
id=flavor_id) from e
except Exception as e:
LOG.exception('Nova reports a failure getting flavor details for '
'flavor ID %s: %s', flavor_id, e)
'flavor ID %s: %s', flavor_id, str(e))
raise
def validate_availability_zone(self, availability_zone):
@ -408,5 +409,5 @@ class VirtualMachineManager(compute_base.ComputeBase):
resource='Nova availability zone', id=availability_zone)
except Exception as e:
LOG.exception('Nova reports a failure getting listing '
'availability zones: %s', e)
'availability zones: %s', str(e))
raise

View File

@ -53,7 +53,8 @@ class TaskUtils(object):
busy=False)
except Exception as e:
LOG.debug('Failed to update amphora health record %(amp)s '
'due to: %(except)s', {'amp': amphora_id, 'except': e})
'due to: %(except)s',
{'amp': amphora_id, 'except': str(e)})
def mark_amphora_status_error(self, amphora_id):
"""Sets an amphora status to ERROR.
@ -69,7 +70,7 @@ class TaskUtils(object):
except Exception as e:
LOG.error("Failed to update amphora %(amp)s "
"status to ERROR due to: "
"%(except)s", {'amp': amphora_id, 'except': e})
"%(except)s", {'amp': amphora_id, 'except': str(e)})
def mark_health_mon_prov_status_error(self, health_mon_id):
"""Sets a health monitor provisioning status to ERROR.
@ -85,7 +86,8 @@ class TaskUtils(object):
except Exception as e:
LOG.error("Failed to update health monitor %(health)s "
"provisioning status to ERROR due to: "
"%(except)s", {'health': health_mon_id, 'except': e})
"%(except)s",
{'health': health_mon_id, 'except': str(e)})
def mark_l7policy_prov_status_active(self, l7policy_id):
"""Sets a L7 policy provisioning status to ACTIVE.
@ -101,7 +103,7 @@ class TaskUtils(object):
except Exception as e:
LOG.error("Failed to update l7policy %(l7p)s "
"provisioning status to ACTIVE due to: "
"%(except)s", {'l7p': l7policy_id, 'except': e})
"%(except)s", {'l7p': l7policy_id, 'except': str(e)})
def mark_l7policy_prov_status_error(self, l7policy_id):
"""Sets a L7 policy provisioning status to ERROR.
@ -117,7 +119,7 @@ class TaskUtils(object):
except Exception as e:
LOG.error("Failed to update l7policy %(l7p)s "
"provisioning status to ERROR due to: "
"%(except)s", {'l7p': l7policy_id, 'except': e})
"%(except)s", {'l7p': l7policy_id, 'except': str(e)})
def mark_l7rule_prov_status_error(self, l7rule_id):
"""Sets a L7 rule provisioning status to ERROR.
@ -133,7 +135,7 @@ class TaskUtils(object):
except Exception as e:
LOG.error("Failed to update l7rule %(l7r)s "
"provisioning status to ERROR due to: "
"%(except)s", {'l7r': l7rule_id, 'except': e})
"%(except)s", {'l7r': l7rule_id, 'except': str(e)})
def mark_listener_prov_status_error(self, listener_id):
"""Sets a listener provisioning status to ERROR.
@ -149,7 +151,7 @@ class TaskUtils(object):
except Exception as e:
LOG.error("Failed to update listener %(list)s "
"provisioning status to ERROR due to: "
"%(except)s", {'list': listener_id, 'except': e})
"%(except)s", {'list': listener_id, 'except': str(e)})
def mark_loadbalancer_prov_status_error(self, loadbalancer_id):
"""Sets a load balancer provisioning status to ERROR.
@ -166,7 +168,7 @@ class TaskUtils(object):
except Exception as e:
LOG.error("Failed to update load balancer %(lb)s "
"provisioning status to ERROR due to: "
"%(except)s", {'lb': loadbalancer_id, 'except': e})
"%(except)s", {'lb': loadbalancer_id, 'except': str(e)})
def mark_listener_prov_status_active(self, listener_id):
"""Sets a listener provisioning status to ACTIVE.
@ -183,7 +185,7 @@ class TaskUtils(object):
except Exception as e:
LOG.error("Failed to update listener %(list)s "
"provisioning status to ACTIVE due to: "
"%(except)s", {'list': listener_id, 'except': e})
"%(except)s", {'list': listener_id, 'except': str(e)})
def mark_pool_prov_status_active(self, pool_id):
"""Sets a pool provisioning status to ACTIVE.
@ -199,7 +201,7 @@ class TaskUtils(object):
except Exception as e:
LOG.error("Failed to update pool %(pool)s provisioning status "
"to ACTIVE due to: %(except)s", {'pool': pool_id,
'except': e})
'except': str(e)})
def mark_loadbalancer_prov_status_active(self, loadbalancer_id):
"""Sets a load balancer provisioning status to ACTIVE.
@ -216,7 +218,7 @@ class TaskUtils(object):
except Exception as e:
LOG.error("Failed to update load balancer %(lb)s "
"provisioning status to ACTIVE due to: "
"%(except)s", {'lb': loadbalancer_id, 'except': e})
"%(except)s", {'lb': loadbalancer_id, 'except': str(e)})
def mark_member_prov_status_error(self, member_id):
"""Sets a member provisioning status to ERROR.
@ -232,7 +234,7 @@ class TaskUtils(object):
except Exception as e:
LOG.error("Failed to update member %(member)s "
"provisioning status to ERROR due to: "
"%(except)s", {'member': member_id, 'except': e})
"%(except)s", {'member': member_id, 'except': str(e)})
def mark_pool_prov_status_error(self, pool_id):
"""Sets a pool provisioning status to ERROR.
@ -248,7 +250,7 @@ class TaskUtils(object):
except Exception as e:
LOG.error("Failed to update pool %(pool)s "
"provisioning status to ERROR due to: "
"%(except)s", {'pool': pool_id, 'except': e})
"%(except)s", {'pool': pool_id, 'except': str(e)})
def get_current_loadbalancer_from_db(self, loadbalancer_id):
"""Gets a Loadbalancer from db.
@ -261,4 +263,4 @@ class TaskUtils(object):
except Exception as e:
LOG.error("Failed to get loadbalancer %(loadbalancer)s "
"due to: %(except)s",
{'loadbalancer': loadbalancer_id, 'except': e})
{'loadbalancer': loadbalancer_id, 'except': str(e)})

View File

@ -110,7 +110,7 @@ class ControllerWorker(base_taskflow.BaseTaskFlowEngine):
return create_amp_tf.storage.fetch('amphora')
except Exception as e:
LOG.error('Failed to create an amphora due to: {}'.format(str(e)))
LOG.error('Failed to create an amphora due to: %s', str(e))
def delete_amphora(self, amphora_id):
"""Deletes an existing Amphora.
@ -127,8 +127,8 @@ class ControllerWorker(base_taskflow.BaseTaskFlowEngine):
with tf_logging.DynamicLoggingListener(delete_amp_tf, log=LOG):
delete_amp_tf.run()
except Exception as e:
LOG.error('Failed to delete a amphora {0} due to: {1}'.format(
amphora_id, str(e)))
LOG.error('Failed to delete a amphora %s due to: %s',
amphora_id, str(e))
return
LOG.info('Finished deleting amphora %s.', amphora_id)
@ -1115,7 +1115,7 @@ class ControllerWorker(base_taskflow.BaseTaskFlowEngine):
except Exception as e:
with excutils.save_and_reraise_exception(reraise=False):
LOG.exception("LB %(lbid)s failover exception: %(exc)s",
{'lbid': load_balancer_id, 'exc': e})
{'lbid': load_balancer_id, 'exc': str(e)})
self._lb_repo.update(
db_apis.get_session(), load_balancer_id,
provisioning_status=constants.ERROR)

View File

@ -451,6 +451,6 @@ class AmphoraConfigUpdate(BaseAmphoraTask):
self.amphora_driver.update_amphora_agent_config(amphora,
agent_config)
except driver_except.AmpDriverNotImplementedError:
LOG.error('Amphora {} does not support agent configuration '
LOG.error('Amphora %s does not support agent configuration '
'update. Please update the amphora image for this '
'amphora. Skipping.'.format(amphora.id))
'amphora. Skipping.', amphora.id)

View File

@ -294,7 +294,7 @@ class NovaServerGroupCreate(BaseComputeTask):
LOG.error("Failed to delete server group. Resources may "
"still be in use for server group: %(sg)s due to "
"error: %(except)s",
{'sg': server_group_id, 'except': e})
{'sg': server_group_id, 'except': str(e)})
class NovaServerGroupDelete(BaseComputeTask):

View File

@ -130,7 +130,7 @@ class CreateAmphoraInDB(BaseDatabaseTask):
except Exception as e:
LOG.error("Failed to delete amphora %(amp)s "
"in the database due to: "
"%(except)s", {'amp': result, 'except': e})
"%(except)s", {'amp': result, 'except': str(e)})
class MarkLBAmphoraeDeletedInDB(BaseDatabaseTask):
@ -238,7 +238,7 @@ class DeleteMemberInDB(BaseDatabaseTask):
except Exception as e:
LOG.error("Failed to update member %(mem)s "
"provisioning_status to ERROR due to: %(except)s",
{'mem': member.id, 'except': e})
{'mem': member.id, 'except': str(e)})
class DeleteListenerInDB(BaseDatabaseTask):
@ -294,7 +294,7 @@ class DeletePoolInDB(BaseDatabaseTask):
except Exception as e:
LOG.error("Failed to update pool %(pool)s "
"provisioning_status to ERROR due to: %(except)s",
{'pool': pool.id, 'except': e})
{'pool': pool.id, 'except': str(e)})
class DeleteL7PolicyInDB(BaseDatabaseTask):
@ -327,7 +327,7 @@ class DeleteL7PolicyInDB(BaseDatabaseTask):
except Exception as e:
LOG.error("Failed to update l7policy %(l7policy)s "
"provisioning_status to ERROR due to: %(except)s",
{'l7policy': l7policy.id, 'except': e})
{'l7policy': l7policy.id, 'except': str(e)})
class DeleteL7RuleInDB(BaseDatabaseTask):
@ -360,7 +360,7 @@ class DeleteL7RuleInDB(BaseDatabaseTask):
except Exception as e:
LOG.error("Failed to update l7rule %(l7rule)s "
"provisioning_status to ERROR due to: %(except)s",
{'l7rule': l7rule.id, 'except': e})
{'l7rule': l7rule.id, 'except': str(e)})
class ReloadAmphora(BaseDatabaseTask):
@ -494,7 +494,7 @@ class AssociateFailoverAmphoraWithLBID(BaseDatabaseTask):
except Exception as e:
LOG.error("Failed to update amphora %(amp)s "
"load balancer id to None due to: "
"%(except)s", {'amp': amphora_id, 'except': e})
"%(except)s", {'amp': amphora_id, 'except': str(e)})
class MapLoadbalancerToAmphora(BaseDatabaseTask):
@ -535,9 +535,10 @@ class MapLoadbalancerToAmphora(BaseDatabaseTask):
loadbalancer_id,
amp_az)
except Exception as e:
LOG.error("Failed to get a spare amphora (AZ: {}) for "
"loadbalancer {} due to: {}".format(
amp_az, loadbalancer_id, e))
LOG.error("Failed to get a spare amphora (AZ: %(amp_az)s) for "
"loadbalancer %(lb_id)s due to: %(except)s",
{'amp_az': amp_az, 'lb_id': loadbalancer_id,
'except': str(e)})
return None
if amp is None:
@ -594,7 +595,7 @@ class _MarkAmphoraRoleAndPriorityInDB(BaseDatabaseTask):
except Exception as e:
LOG.error("Failed to update amphora %(amp)s "
"role and vrrp_priority to None due to: "
"%(except)s", {'amp': amphora.id, 'except': e})
"%(except)s", {'amp': amphora.id, 'except': str(e)})
class MarkAmphoraMasterInDB(_MarkAmphoraRoleAndPriorityInDB):
@ -747,7 +748,7 @@ class MarkAmphoraBootingInDB(BaseDatabaseTask):
except Exception as e:
LOG.error("Failed to update amphora %(amp)s "
"status to ERROR due to: "
"%(except)s", {'amp': amphora_id, 'except': e})
"%(except)s", {'amp': amphora_id, 'except': str(e)})
class MarkAmphoraDeletedInDB(BaseDatabaseTask):
@ -886,7 +887,7 @@ class MarkAmphoraReadyInDB(BaseDatabaseTask):
except Exception as e:
LOG.error("Failed to update amphora %(amp)s "
"status to ERROR due to: "
"%(except)s", {'amp': amphora.id, 'except': e})
"%(except)s", {'amp': amphora.id, 'except': str(e)})
class UpdateAmphoraComputeId(BaseDatabaseTask):
@ -1110,7 +1111,7 @@ class UpdateLBServerGroupInDB(BaseDatabaseTask):
except Exception as e:
LOG.error("Failed to update load balancer %(lb)s "
"server_group_id to None due to: "
"%(except)s", {'lb': loadbalancer_id, 'except': e})
"%(except)s", {'lb': loadbalancer_id, 'except': str(e)})
class MarkLBDeletedInDB(BaseDatabaseTask):
@ -1347,7 +1348,7 @@ class UpdateHealthMonInDB(BaseDatabaseTask):
except Exception as e:
LOG.error("Failed to update health monitor %(hm)s "
"provisioning_status to ERROR due to: %(except)s",
{'hm': health_mon.id, 'except': e})
{'hm': health_mon.id, 'except': str(e)})
class UpdateListenerInDB(BaseDatabaseTask):
@ -1413,7 +1414,7 @@ class UpdateMemberInDB(BaseDatabaseTask):
except Exception as e:
LOG.error("Failed to update member %(member)s provisioning_status "
"to ERROR due to: %(except)s", {'member': member.id,
'except': e})
'except': str(e)})
class UpdatePoolInDB(BaseDatabaseTask):
@ -1449,7 +1450,7 @@ class UpdatePoolInDB(BaseDatabaseTask):
except Exception as e:
LOG.error("Failed to update pool %(pool)s provisioning_status to "
"ERROR due to: %(except)s", {'pool': pool.id,
'except': e})
'except': str(e)})
class UpdateL7PolicyInDB(BaseDatabaseTask):
@ -1485,7 +1486,7 @@ class UpdateL7PolicyInDB(BaseDatabaseTask):
except Exception as e:
LOG.error("Failed to update l7policy %(l7p)s provisioning_status "
"to ERROR due to: %(except)s", {'l7p': l7policy.id,
'except': e})
'except': str(e)})
class UpdateL7RuleInDB(BaseDatabaseTask):
@ -1522,7 +1523,7 @@ class UpdateL7RuleInDB(BaseDatabaseTask):
except Exception as e:
LOG.error("Failed to update L7rule %(l7r)s provisioning_status to "
"ERROR due to: %(except)s", {'l7r': l7rule.l7policy.id,
'except': e})
'except': str(e)})
class GetAmphoraDetails(BaseDatabaseTask):

View File

@ -361,7 +361,7 @@ class PlugVIP(BaseNetworkTask):
except Exception as e:
LOG.error("Failed to unplug VIP. Resources may still "
"be in use from vip: %(vip)s due to error: %(except)s",
{'vip': loadbalancer.vip.ip_address, 'except': e})
{'vip': loadbalancer.vip.ip_address, 'except': str(e)})
class UpdateVIPSecurityGroup(BaseNetworkTask):
@ -422,7 +422,8 @@ class PlugVIPAmpphora(BaseNetworkTask):
amphora, subnet)
except Exception as e:
LOG.error('Failed to unplug AAP port. Resources may still be in '
'use for VIP: %s due to error: %s', loadbalancer.vip, e)
'use for VIP: %s due to error: %s', loadbalancer.vip,
str(e))
class UnplugVIP(BaseNetworkTask):
@ -465,7 +466,7 @@ class AllocateVIP(BaseNetworkTask):
except Exception as e:
LOG.error("Failed to deallocate VIP. Resources may still "
"be in use from vip: %(vip)s due to error: %(except)s",
{'vip': vip.ip_address, 'except': e})
{'vip': vip.ip_address, 'except': str(e)})
class DeallocateVIP(BaseNetworkTask):
@ -661,7 +662,8 @@ class ApplyQosAmphora(BaseNetworkTask):
request_qos_id=request_qos_id)
except Exception as e:
LOG.error('Failed to remove QoS policy: %s from port: %s due '
'to error: %s', orig_qos_id, amp_data.vrrp_port_id, e)
'to error: %s', orig_qos_id, amp_data.vrrp_port_id,
str(e))
class DeletePort(BaseNetworkTask):

View File

@ -128,7 +128,7 @@ class ControllerWorker(object):
flow_utils.get_create_amphora_flow,
store=store, wait=True)
except Exception as e:
LOG.error('Failed to create an amphora due to: {}'.format(str(e)))
LOG.error('Failed to create an amphora due to: %s', str(e))
def delete_amphora(self, amphora_id):
"""Deletes an existing Amphora.
@ -145,8 +145,8 @@ class ControllerWorker(object):
flow_utils.get_delete_amphora_flow,
store=store)
except Exception as e:
LOG.error('Failed to delete a amphora {0} due to: {1}'.format(
amphora_id, str(e)))
LOG.error('Failed to delete a amphora %s due to: %s',
amphora_id, str(e))
return
LOG.info('Finished deleting amphora %s.', amphora_id)
@ -1084,7 +1084,7 @@ class ControllerWorker(object):
except Exception as e:
with excutils.save_and_reraise_exception(reraise=False):
LOG.exception("LB %(lbid)s failover exception: %(exc)s",
{'lbid': load_balancer_id, 'exc': e})
{'lbid': load_balancer_id, 'exc': str(e)})
self._lb_repo.update(
db_apis.get_session(), load_balancer_id,
provisioning_status=constants.ERROR)

View File

@ -311,7 +311,7 @@ class NovaServerGroupCreate(BaseComputeTask):
LOG.error("Failed to delete server group. Resources may "
"still be in use for server group: %(sg)s due to "
"error: %(except)s",
{'sg': server_group_id, 'except': e})
{'sg': server_group_id, 'except': str(e)})
class NovaServerGroupDelete(BaseComputeTask):

View File

@ -131,7 +131,7 @@ class CreateAmphoraInDB(BaseDatabaseTask):
except Exception as e:
LOG.error("Failed to delete amphora %(amp)s "
"in the database due to: "
"%(except)s", {'amp': result, 'except': e})
"%(except)s", {'amp': result, 'except': str(e)})
class MarkLBAmphoraeDeletedInDB(BaseDatabaseTask):
@ -256,7 +256,7 @@ class DeleteMemberInDB(BaseDatabaseTask):
except Exception as e:
LOG.error("Failed to update member %(mem)s "
"provisioning_status to ERROR due to: %(except)s",
{'mem': member[constants.MEMBER_ID], 'except': e})
{'mem': member[constants.MEMBER_ID], 'except': str(e)})
class DeleteListenerInDB(BaseDatabaseTask):
@ -315,7 +315,7 @@ class DeletePoolInDB(BaseDatabaseTask):
except Exception as e:
LOG.error("Failed to update pool %(pool)s "
"provisioning_status to ERROR due to: %(except)s",
{'pool': pool_id, 'except': e})
{'pool': pool_id, 'except': str(e)})
class DeleteL7PolicyInDB(BaseDatabaseTask):
@ -353,7 +353,7 @@ class DeleteL7PolicyInDB(BaseDatabaseTask):
LOG.error("Failed to update l7policy %(l7policy)s "
"provisioning_status to ERROR due to: %(except)s",
{'l7policy': l7policy[constants.L7POLICY_ID],
'except': e})
'except': str(e)})
class DeleteL7RuleInDB(BaseDatabaseTask):
@ -390,7 +390,8 @@ class DeleteL7RuleInDB(BaseDatabaseTask):
except Exception as e:
LOG.error("Failed to update l7rule %(l7rule)s "
"provisioning_status to ERROR due to: %(except)s",
{'l7rule': l7rule[constants.L7RULE_ID], 'except': e})
{'l7rule': l7rule[constants.L7RULE_ID],
'except': str(e)})
class ReloadAmphora(BaseDatabaseTask):
@ -541,7 +542,7 @@ class AssociateFailoverAmphoraWithLBID(BaseDatabaseTask):
except Exception as e:
LOG.error("Failed to update amphora %(amp)s "
"load balancer id to None due to: "
"%(except)s", {'amp': amphora_id, 'except': e})
"%(except)s", {'amp': amphora_id, 'except': str(e)})
class MapLoadbalancerToAmphora(BaseDatabaseTask):
@ -633,7 +634,7 @@ class _MarkAmphoraRoleAndPriorityInDB(BaseDatabaseTask):
except Exception as e:
LOG.error("Failed to update amphora %(amp)s "
"role and vrrp_priority to None due to: "
"%(except)s", {'amp': amphora_id, 'except': e})
"%(except)s", {'amp': amphora_id, 'except': str(e)})
class MarkAmphoraMasterInDB(_MarkAmphoraRoleAndPriorityInDB):
@ -793,7 +794,7 @@ class MarkAmphoraBootingInDB(BaseDatabaseTask):
except Exception as e:
LOG.error("Failed to update amphora %(amp)s "
"status to ERROR due to: "
"%(except)s", {'amp': amphora_id, 'except': e})
"%(except)s", {'amp': amphora_id, 'except': str(e)})
class MarkAmphoraDeletedInDB(BaseDatabaseTask):
@ -949,7 +950,7 @@ class MarkAmphoraReadyInDB(BaseDatabaseTask):
LOG.error("Failed to update amphora %(amp)s "
"status to ERROR due to: "
"%(except)s", {'amp': amphora.get(constants.ID),
'except': e})
'except': str(e)})
class UpdateAmphoraComputeId(BaseDatabaseTask):
@ -1218,7 +1219,7 @@ class UpdateLBServerGroupInDB(BaseDatabaseTask):
except Exception as e:
LOG.error("Failed to update load balancer %(lb)s "
"server_group_id to None due to: "
"%(except)s", {'lb': loadbalancer_id, 'except': e})
"%(except)s", {'lb': loadbalancer_id, 'except': str(e)})
class MarkLBDeletedInDB(BaseDatabaseTask):
@ -1483,7 +1484,7 @@ class UpdateHealthMonInDB(BaseDatabaseTask):
LOG.error("Failed to update health monitor %(hm)s "
"provisioning_status to ERROR due to: %(except)s",
{'hm': health_mon[constants.HEALTHMONITOR_ID],
'except': e})
'except': str(e)})
class UpdateListenerInDB(BaseDatabaseTask):
@ -1554,7 +1555,8 @@ class UpdateMemberInDB(BaseDatabaseTask):
except Exception as e:
LOG.error("Failed to update member %(member)s provisioning_status "
"to ERROR due to: %(except)s",
{'member': member[constants.MEMBER_ID], 'except': e})
{'member': member[constants.MEMBER_ID],
'except': str(e)})
class UpdatePoolInDB(BaseDatabaseTask):
@ -1590,7 +1592,7 @@ class UpdatePoolInDB(BaseDatabaseTask):
except Exception as e:
LOG.error("Failed to update pool %(pool)s provisioning_status to "
"ERROR due to: %(except)s", {'pool': pool_id,
'except': e})
'except': str(e)})
class UpdateL7PolicyInDB(BaseDatabaseTask):
@ -1629,7 +1631,8 @@ class UpdateL7PolicyInDB(BaseDatabaseTask):
except Exception as e:
LOG.error("Failed to update l7policy %(l7p)s provisioning_status "
"to ERROR due to: %(except)s",
{'l7p': l7policy[constants.L7POLICY_ID], 'except': e})
{'l7p': l7policy[constants.L7POLICY_ID],
'except': str(e)})
class UpdateL7RuleInDB(BaseDatabaseTask):
@ -1667,7 +1670,7 @@ class UpdateL7RuleInDB(BaseDatabaseTask):
except Exception as e:
LOG.error("Failed to update L7rule %(l7r)s provisioning_status to "
"ERROR due to: %(except)s",
{'l7r': l7rule[constants.L7POLICY_ID], 'except': e})
{'l7r': l7rule[constants.L7POLICY_ID], 'except': str(e)})
class GetAmphoraDetails(BaseDatabaseTask):

View File

@ -393,7 +393,7 @@ class PlugVIP(BaseNetworkTask):
except Exception as e:
LOG.error("Failed to unplug VIP. Resources may still "
"be in use from vip: %(vip)s due to error: %(except)s",
{'vip': loadbalancer['vip_address'], 'except': e})
{'vip': loadbalancer['vip_address'], 'except': str(e)})
class UpdateVIPSecurityGroup(BaseNetworkTask):
@ -460,7 +460,7 @@ class PlugVIPAmphora(BaseNetworkTask):
db_amp, subnet)
except Exception as e:
LOG.error('Failed to unplug AAP port. Resources may still be in '
'use for VIP: %s due to error: %s', db_lb.vip, e)
'use for VIP: %s due to error: %s', db_lb.vip, str(e))
class UnplugVIP(BaseNetworkTask):
@ -509,7 +509,7 @@ class AllocateVIP(BaseNetworkTask):
except Exception as e:
LOG.error("Failed to deallocate VIP. Resources may still "
"be in use from vip: %(vip)s due to error: %(except)s",
{'vip': vip.ip_address, 'except': e})
{'vip': vip.ip_address, 'except': str(e)})
class DeallocateVIP(BaseNetworkTask):
@ -747,7 +747,7 @@ class ApplyQosAmphora(BaseNetworkTask):
except Exception as e:
LOG.error('Failed to remove QoS policy: %s from port: %s due '
'to error: %s', orig_qos_id,
amp_data[constants.VRRP_PORT_ID], e)
amp_data[constants.VRRP_PORT_ID], str(e))
class DeletePort(BaseNetworkTask):

View File

@ -349,9 +349,9 @@ class AllowedAddressPairsDriver(neutron_base.BaseNeutronDriver):
try:
port = self.get_port(vip.port_id)
except base.PortNotFound:
LOG.warning("Can't deallocate VIP because the vip port {0} "
LOG.warning("Can't deallocate VIP because the vip port %s "
"cannot be found in neutron. "
"Continuing cleanup.".format(vip.port_id))
"Continuing cleanup.", vip.port_id)
port = None
self._delete_security_group(vip, port)
@ -565,7 +565,7 @@ class AllowedAddressPairsDriver(neutron_base.BaseNeutronDriver):
except Exception as e:
LOG.error('Failed to delete port. Resources may still be in '
'use for port: %(port)s due to error: %(except)s',
{constants.PORT: amphora.vrrp_port_id, 'except': e})
{constants.PORT: amphora.vrrp_port_id, 'except': str(e)})
def unplug_vip(self, load_balancer, vip):
try:
@ -623,9 +623,8 @@ class AllowedAddressPairsDriver(neutron_base.BaseNeutronDriver):
raise exceptions.MissingVIPSecurityGroup(lb_id=load_balancer.id)
else:
LOG.warning('VIP security group missing when updating the VIP for '
'delete on load balancer: {lb_id}. Skipping update '
'because this is for delete.'.format(
lb_id=load_balancer.id))
'delete on load balancer: %s. Skipping update '
'because this is for delete.', load_balancer.id)
def failover_preparation(self, amphora):
if self.dns_integration_enabled:

View File

@ -36,7 +36,7 @@ class TestAvailabilityZones(base.BaseAPITest):
'test1', 'noop_driver', '{"compute_zone": "my_az_1"}')
def _assert_request_matches_response(self, req, resp, **optionals):
self.assertTrue('id' not in resp) # AZs do not expose an ID
self.assertNotIn('id', resp) # AZs do not expose an ID
req_description = req.get('description')
self.assertEqual(req.get('name'), resp.get('name'))
if not req_description:

View File

@ -39,9 +39,9 @@ class TestProvider(base.BaseAPITest):
noop_dict = {u'description': u'NoOp driver.', u'name': u'noop_driver'}
providers = self.get(self.PROVIDERS_PATH).json.get(self.root_tag_list)
self.assertEqual(4, len(providers))
self.assertTrue(octavia_dict in providers)
self.assertTrue(amphora_dict in providers)
self.assertTrue(noop_dict in providers)
self.assertIn(octavia_dict, providers)
self.assertIn(amphora_dict, providers)
self.assertIn(noop_dict, providers)
def test_get_all_providers_fields(self):
octavia_dict = {u'name': u'octavia'}
@ -50,9 +50,9 @@ class TestProvider(base.BaseAPITest):
providers = self.get(self.PROVIDERS_PATH, params={'fields': ['name']})
providers_list = providers.json.get(self.root_tag_list)
self.assertEqual(4, len(providers_list))
self.assertTrue(octavia_dict in providers_list)
self.assertTrue(amphora_dict in providers_list)
self.assertTrue(noop_dict in providers_list)
self.assertIn(octavia_dict, providers_list)
self.assertIn(amphora_dict, providers_list)
self.assertIn(noop_dict, providers_list)
class TestFlavorCapabilities(base.BaseAPITest):

View File

@ -49,6 +49,7 @@
check_timeout: 180
devstack_plugins:
octavia: https://opendev.org/openstack/octavia.git
octavia-tempest-plugin: https://opendev.org/openstack/octavia-tempest-plugin.git
devstack_services:
s-account: false
s-container: false