Merge "Trivial change to adapt pylint rules"
This commit is contained in:
commit
5e19bf3221
|
@ -408,7 +408,7 @@ class Listener(object):
|
|||
mode = stat.S_IRUSR | stat.S_IWUSR
|
||||
with os.fdopen(os.open(file, flags, mode), 'wb') as crt_file:
|
||||
b = stream.read(BUFFER)
|
||||
while (b):
|
||||
while b:
|
||||
crt_file.write(b)
|
||||
b = stream.read(BUFFER)
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ class BaseType(wtypes.Base):
|
|||
if attr == 'tenant_id':
|
||||
continue
|
||||
if value and callable(value):
|
||||
continue
|
||||
continue
|
||||
if value and isinstance(value, BaseType):
|
||||
value = value.to_dict(render_unsets=render_unsets)
|
||||
if value and isinstance(value, list):
|
||||
|
|
|
@ -286,9 +286,9 @@ class LoadBalancersController(base.BaseController):
|
|||
elif controller == 'pools':
|
||||
return pool.PoolsController(
|
||||
load_balancer_id=db_lb.id), remainder
|
||||
elif (controller == 'delete_cascade'):
|
||||
elif controller == 'delete_cascade':
|
||||
return LBCascadeDeleteController(db_lb.id), ''
|
||||
elif (controller == 'stats'):
|
||||
elif controller == 'stats':
|
||||
return lb_stats.LoadBalancerStatisticsController(
|
||||
loadbalancer_id=db_lb.id), remainder
|
||||
|
||||
|
|
|
@ -319,52 +319,52 @@ def _get_x509_from_der_bytes(certificate_der):
|
|||
|
||||
|
||||
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
|
||||
:returns: Pem encoded certificate file
|
||||
"""
|
||||
pem = [tls_container.certificate, tls_container.private_key]
|
||||
if tls_container.intermediates:
|
||||
pem.extend(tls_container.intermediates[:])
|
||||
return b'\n'.join(pem) + b'\n'
|
||||
:param tls_container: Object container TLS certificates
|
||||
:returns: Pem encoded certificate file
|
||||
"""
|
||||
pem = [tls_container.certificate, tls_container.private_key]
|
||||
if tls_container.intermediates:
|
||||
pem.extend(tls_container.intermediates[:])
|
||||
return b'\n'.join(pem) + b'\n'
|
||||
|
||||
|
||||
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
|
||||
"""
|
||||
tls_cert = None
|
||||
sni_certs = []
|
||||
return TLS_CERT and SNI_CERTS
|
||||
"""
|
||||
tls_cert = None
|
||||
sni_certs = []
|
||||
|
||||
if listener.tls_certificate_id:
|
||||
tls_cert = _map_cert_tls_container(
|
||||
if listener.tls_certificate_id:
|
||||
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,
|
||||
listener.tls_certificate_id,
|
||||
sni_cont.tls_container_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,
|
||||
sni_cont.tls_container_id,
|
||||
check_only=True))
|
||||
sni_certs.append(cert_container)
|
||||
return {'tls_cert': tls_cert, 'sni_certs': sni_certs}
|
||||
sni_certs.append(cert_container)
|
||||
return {'tls_cert': tls_cert, 'sni_certs': sni_certs}
|
||||
|
||||
|
||||
def _map_cert_tls_container(cert):
|
||||
return data_models.TLSContainer(
|
||||
primary_cn=get_primary_cn(cert),
|
||||
private_key=prepare_private_key(
|
||||
cert.get_private_key(),
|
||||
cert.get_private_key_passphrase()),
|
||||
certificate=cert.get_certificate(),
|
||||
intermediates=cert.get_intermediates())
|
||||
return data_models.TLSContainer(
|
||||
primary_cn=get_primary_cn(cert),
|
||||
private_key=prepare_private_key(
|
||||
cert.get_private_key(),
|
||||
cert.get_private_key_passphrase()),
|
||||
certificate=cert.get_certificate(),
|
||||
intermediates=cert.get_intermediates())
|
||||
|
||||
|
||||
def get_primary_cn(tls_cert):
|
||||
"""Returns primary CN for Certificate."""
|
||||
return get_host_names(tls_cert.get_certificate())['cn']
|
||||
"""Returns primary CN for Certificate."""
|
||||
return get_host_names(tls_cert.get_certificate())['cn']
|
||||
|
|
|
@ -47,7 +47,7 @@ class EventStreamerNoop(EventStreamerBase):
|
|||
"""
|
||||
|
||||
def emit(self, cnt):
|
||||
pass
|
||||
pass
|
||||
|
||||
|
||||
class EventStreamerNeutron(EventStreamerBase):
|
||||
|
|
|
@ -181,10 +181,9 @@ class UnPlugNetworks(BaseNetworkTask):
|
|||
nic.network_id)
|
||||
except base.NetworkNotFound:
|
||||
LOG.debug("Network %d not found", nic.network_id)
|
||||
pass
|
||||
except Exception:
|
||||
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):
|
||||
|
|
Loading…
Reference in New Issue