Trivial change to adapt pylint rules
Eliminate bad-indentation superfluous-parens unnecessary-pass pylint will be added in fllow up patch ************* Module octavia.common.tls_utils.cert_parser W:322, 0: Bad indentation. Found 8 spaces, expected 4 (bad-indentation) ************* Module octavia.api.v1.controllers.load_balancer C:289, 0: Unnecessary parens after 'elif' keyword (superfluous-parens) ************* Module octavia.controller.worker.tasks.network_tasks W:184,16: Unnecessary pass statement (unnecessary-pass) Change-Id: Ice1755aee84f33cd190cfcaa6379723f0fcdb9e9
This commit is contained in:
parent
4ee7b97743
commit
3486879df0
|
@ -408,7 +408,7 @@ class Listener(object):
|
||||||
mode = stat.S_IRUSR | stat.S_IWUSR
|
mode = stat.S_IRUSR | stat.S_IWUSR
|
||||||
with os.fdopen(os.open(file, flags, mode), 'wb') as crt_file:
|
with os.fdopen(os.open(file, flags, mode), 'wb') as crt_file:
|
||||||
b = stream.read(BUFFER)
|
b = stream.read(BUFFER)
|
||||||
while (b):
|
while b:
|
||||||
crt_file.write(b)
|
crt_file.write(b)
|
||||||
b = stream.read(BUFFER)
|
b = stream.read(BUFFER)
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,7 @@ class BaseType(wtypes.Base):
|
||||||
if attr == 'tenant_id':
|
if attr == 'tenant_id':
|
||||||
continue
|
continue
|
||||||
if value and callable(value):
|
if value and callable(value):
|
||||||
continue
|
continue
|
||||||
if value and isinstance(value, BaseType):
|
if value and isinstance(value, BaseType):
|
||||||
value = value.to_dict(render_unsets=render_unsets)
|
value = value.to_dict(render_unsets=render_unsets)
|
||||||
if value and isinstance(value, list):
|
if value and isinstance(value, list):
|
||||||
|
|
|
@ -286,9 +286,9 @@ class LoadBalancersController(base.BaseController):
|
||||||
elif controller == 'pools':
|
elif controller == 'pools':
|
||||||
return pool.PoolsController(
|
return pool.PoolsController(
|
||||||
load_balancer_id=db_lb.id), remainder
|
load_balancer_id=db_lb.id), remainder
|
||||||
elif (controller == 'delete_cascade'):
|
elif controller == 'delete_cascade':
|
||||||
return LBCascadeDeleteController(db_lb.id), ''
|
return LBCascadeDeleteController(db_lb.id), ''
|
||||||
elif (controller == 'stats'):
|
elif controller == 'stats':
|
||||||
return lb_stats.LoadBalancerStatisticsController(
|
return lb_stats.LoadBalancerStatisticsController(
|
||||||
loadbalancer_id=db_lb.id), remainder
|
loadbalancer_id=db_lb.id), remainder
|
||||||
|
|
||||||
|
|
|
@ -319,52 +319,52 @@ def _get_x509_from_der_bytes(certificate_der):
|
||||||
|
|
||||||
|
|
||||||
def build_pem(tls_container):
|
def build_pem(tls_container):
|
||||||
"""Concatenate TLS container fields to create a PEM
|
"""Concatenate TLS container fields to create a PEM
|
||||||
|
|
||||||
encoded certificate file
|
encoded certificate file
|
||||||
|
|
||||||
:param tls_container: Object container TLS certificates
|
:param tls_container: Object container TLS certificates
|
||||||
:returns: Pem encoded certificate file
|
:returns: Pem encoded certificate file
|
||||||
"""
|
"""
|
||||||
pem = [tls_container.certificate, tls_container.private_key]
|
pem = [tls_container.certificate, tls_container.private_key]
|
||||||
if tls_container.intermediates:
|
if tls_container.intermediates:
|
||||||
pem.extend(tls_container.intermediates[:])
|
pem.extend(tls_container.intermediates[:])
|
||||||
return b'\n'.join(pem) + b'\n'
|
return b'\n'.join(pem) + b'\n'
|
||||||
|
|
||||||
|
|
||||||
def load_certificates_data(cert_mngr, listener):
|
def load_certificates_data(cert_mngr, listener):
|
||||||
"""Load TLS certificate data from the listener.
|
"""Load TLS certificate data from the listener.
|
||||||
|
|
||||||
return TLS_CERT and SNI_CERTS
|
return TLS_CERT and SNI_CERTS
|
||||||
"""
|
"""
|
||||||
tls_cert = None
|
tls_cert = None
|
||||||
sni_certs = []
|
sni_certs = []
|
||||||
|
|
||||||
if listener.tls_certificate_id:
|
if listener.tls_certificate_id:
|
||||||
tls_cert = _map_cert_tls_container(
|
tls_cert = _map_cert_tls_container(
|
||||||
|
cert_mngr.get_cert(listener.project_id,
|
||||||
|
listener.tls_certificate_id,
|
||||||
|
check_only=True))
|
||||||
|
if listener.sni_containers:
|
||||||
|
for sni_cont in listener.sni_containers:
|
||||||
|
cert_container = _map_cert_tls_container(
|
||||||
cert_mngr.get_cert(listener.project_id,
|
cert_mngr.get_cert(listener.project_id,
|
||||||
listener.tls_certificate_id,
|
sni_cont.tls_container_id,
|
||||||
check_only=True))
|
check_only=True))
|
||||||
if listener.sni_containers:
|
sni_certs.append(cert_container)
|
||||||
for sni_cont in listener.sni_containers:
|
return {'tls_cert': tls_cert, 'sni_certs': sni_certs}
|
||||||
cert_container = _map_cert_tls_container(
|
|
||||||
cert_mngr.get_cert(listener.project_id,
|
|
||||||
sni_cont.tls_container_id,
|
|
||||||
check_only=True))
|
|
||||||
sni_certs.append(cert_container)
|
|
||||||
return {'tls_cert': tls_cert, 'sni_certs': sni_certs}
|
|
||||||
|
|
||||||
|
|
||||||
def _map_cert_tls_container(cert):
|
def _map_cert_tls_container(cert):
|
||||||
return data_models.TLSContainer(
|
return data_models.TLSContainer(
|
||||||
primary_cn=get_primary_cn(cert),
|
primary_cn=get_primary_cn(cert),
|
||||||
private_key=prepare_private_key(
|
private_key=prepare_private_key(
|
||||||
cert.get_private_key(),
|
cert.get_private_key(),
|
||||||
cert.get_private_key_passphrase()),
|
cert.get_private_key_passphrase()),
|
||||||
certificate=cert.get_certificate(),
|
certificate=cert.get_certificate(),
|
||||||
intermediates=cert.get_intermediates())
|
intermediates=cert.get_intermediates())
|
||||||
|
|
||||||
|
|
||||||
def get_primary_cn(tls_cert):
|
def get_primary_cn(tls_cert):
|
||||||
"""Returns primary CN for Certificate."""
|
"""Returns primary CN for Certificate."""
|
||||||
return get_host_names(tls_cert.get_certificate())['cn']
|
return get_host_names(tls_cert.get_certificate())['cn']
|
||||||
|
|
|
@ -47,7 +47,7 @@ class EventStreamerNoop(EventStreamerBase):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def emit(self, cnt):
|
def emit(self, cnt):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class EventStreamerNeutron(EventStreamerBase):
|
class EventStreamerNeutron(EventStreamerBase):
|
||||||
|
|
|
@ -181,10 +181,9 @@ class UnPlugNetworks(BaseNetworkTask):
|
||||||
nic.network_id)
|
nic.network_id)
|
||||||
except base.NetworkNotFound:
|
except base.NetworkNotFound:
|
||||||
LOG.debug("Network %d not found", nic.network_id)
|
LOG.debug("Network %d not found", nic.network_id)
|
||||||
pass
|
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.exception("Unable to unplug network")
|
LOG.exception("Unable to unplug network")
|
||||||
pass # Todo(german) follow up if that makes sense
|
# TODO(xgerman) follow up if that makes sense
|
||||||
|
|
||||||
|
|
||||||
class GetMemberPorts(BaseNetworkTask):
|
class GetMemberPorts(BaseNetworkTask):
|
||||||
|
|
Loading…
Reference in New Issue