Fix pep8 job after flake8 upgrade
Seems like flake8 3.8.1 got released that introduced new rules we violate, rendering our pep8 job broken. This commit fixes them. Change-Id: I7e4f2767856be8666c8f37f3b481f8bf43412ce8
This commit is contained in:
parent
9f98538f36
commit
4ebece5fa6
@ -88,8 +88,8 @@ class VIFVHostUserDriver(health.HealthHandler, base.BaseBindingDriver):
|
||||
dst_vhu_sock, vif.id)
|
||||
os.rename(src_vhu_sock, dst_vhu_sock)
|
||||
else:
|
||||
error_msg = "Socket %s required for VIF %s doesn't exist".format(
|
||||
src_vhu_sock, vif.id)
|
||||
error_msg = ("Socket %s required for VIF %s doesn't exist" %
|
||||
(src_vhu_sock, vif.id))
|
||||
LOG.error(error_msg)
|
||||
raise k_exc.CNIError(error_msg)
|
||||
|
||||
|
@ -613,7 +613,7 @@ class LBaaSv2Driver(base.LBaaSDriver):
|
||||
try:
|
||||
if by_listener:
|
||||
pools = [p for p in response if pool.listener_id
|
||||
in {l['id'] for l in p.listeners}]
|
||||
in {listener['id'] for listener in p.listeners}]
|
||||
else:
|
||||
pools = [p for p in response if pool.name == p.name]
|
||||
|
||||
@ -807,7 +807,8 @@ class LBaaSv2Driver(base.LBaaSDriver):
|
||||
|
||||
utils.set_lbaas_state(endpoint, lbaas)
|
||||
|
||||
lsnr_ids = {(l.protocol, l.port): l.id for l in lbaas.listeners}
|
||||
lsnr_ids = {(listener.protocol, listener.port): listener.id
|
||||
for listener in lbaas.listeners}
|
||||
|
||||
for port in svc_ports:
|
||||
port_protocol = port['protocol']
|
||||
|
@ -306,7 +306,8 @@ class LoadBalancerHandler(k8s_base.ResourceEventHandler):
|
||||
LOG.debug("The svc has been deleted while processing the endpoints"
|
||||
" update. No need to add new members.")
|
||||
|
||||
lsnr_by_id = {l.id: l for l in lbaas_state.listeners}
|
||||
lsnr_by_id = {listener.id: listener
|
||||
for listener in lbaas_state.listeners}
|
||||
pool_by_lsnr_port = {(lsnr_by_id[p.listener_id].protocol,
|
||||
lsnr_by_id[p.listener_id].port): p
|
||||
for p in lbaas_state.pools}
|
||||
@ -410,11 +411,12 @@ class LoadBalancerHandler(k8s_base.ResourceEventHandler):
|
||||
return config.CONF.pod_vif_nested.worker_nodes_subnet
|
||||
|
||||
def _get_port_in_pool(self, pool, lbaas_state, lbaas_spec):
|
||||
for l in lbaas_state.listeners:
|
||||
if l.id != pool.listener_id:
|
||||
for listener in lbaas_state.listeners:
|
||||
if listener.id != pool.listener_id:
|
||||
continue
|
||||
for port in lbaas_spec.ports:
|
||||
if l.port == port.port and l.protocol == port.protocol:
|
||||
if (listener.port == port.port and
|
||||
listener.protocol == port.protocol):
|
||||
return port
|
||||
return None
|
||||
|
||||
@ -487,11 +489,12 @@ class LoadBalancerHandler(k8s_base.ResourceEventHandler):
|
||||
# we should:
|
||||
# 1. get the listener that pool is attached to
|
||||
# 2. check if listener's attributes appear in lbaas_spec.
|
||||
for l in lbaas_state.listeners:
|
||||
if l.id != pool.listener_id:
|
||||
for listener in lbaas_state.listeners:
|
||||
if listener.id != pool.listener_id:
|
||||
continue
|
||||
for port in lbaas_spec.ports:
|
||||
if l.port == port.port and l.protocol == port.protocol:
|
||||
if (listener.port == port.port and
|
||||
listener.protocol == port.protocol):
|
||||
return True
|
||||
return False
|
||||
|
||||
@ -531,15 +534,17 @@ class LoadBalancerHandler(k8s_base.ResourceEventHandler):
|
||||
protocol = port_spec.protocol
|
||||
port = port_spec.port
|
||||
name = "%s:%s" % (lbaas_state.loadbalancer.name, protocol)
|
||||
listener = [l for l in lbaas_state.listeners
|
||||
if l.port == port and l.protocol == protocol]
|
||||
listener = [listener for listener in lbaas_state.listeners
|
||||
if listener.port == port and
|
||||
listener.protocol == protocol]
|
||||
if listener:
|
||||
continue
|
||||
# FIXME (maysams): Due to a bug in Octavia, which does
|
||||
# not allows listeners with same port but different
|
||||
# protocols to co-exist, we need to skip the creation of
|
||||
# listeners that have the same port as an existing one.
|
||||
listener = [l for l in lbaas_state.listeners if l.port == port]
|
||||
listener = [listener for listener in lbaas_state.listeners if
|
||||
listener.port == port]
|
||||
if listener and not self._drv_lbaas.double_listeners_supported():
|
||||
LOG.warning("Skipping listener creation for %s as another one"
|
||||
" already exists with port %s", name, port)
|
||||
@ -565,8 +570,9 @@ class LoadBalancerHandler(k8s_base.ResourceEventHandler):
|
||||
listener)
|
||||
removed_ids.add(listener.id)
|
||||
if removed_ids:
|
||||
lbaas_state.listeners = [l for l in lbaas_state.listeners
|
||||
if l.id not in removed_ids]
|
||||
lbaas_state.listeners = [
|
||||
listener for listener in lbaas_state.listeners
|
||||
if listener.id not in removed_ids]
|
||||
return bool(removed_ids)
|
||||
|
||||
def _update_lb_status(self, endpoints, lb_ip_address):
|
||||
|
@ -157,8 +157,7 @@ class TestRequestHandler(test_base.TestCase):
|
||||
headers['Content-Length'] = len(body)
|
||||
trigger_exception = False
|
||||
|
||||
expected_resp = ('Trunk port IP(s) missing.'
|
||||
.format(trunk_ips, num_ports)).encode()
|
||||
expected_resp = ('Trunk port IP(s) missing.').encode()
|
||||
|
||||
self._do_POST_helper(method, path, headers, body, expected_resp,
|
||||
trigger_exception, trunk_ips, num_ports)
|
||||
|
Loading…
x
Reference in New Issue
Block a user