Merge "Fix some inconsistency in docstrings"
This commit is contained in:
commit
51d621f128
@ -65,7 +65,7 @@ class BarbicanKeystoneAuth(object):
|
|||||||
def get_barbican_client(cls):
|
def get_barbican_client(cls):
|
||||||
"""Creates a Barbican client object.
|
"""Creates a Barbican client object.
|
||||||
|
|
||||||
:return: a Barbican Client object
|
:returns: a Barbican Client object
|
||||||
:raises Exception: if the client cannot be created
|
:raises Exception: if the client cannot be created
|
||||||
"""
|
"""
|
||||||
if not cls._barbican_client:
|
if not cls._barbican_client:
|
||||||
@ -179,7 +179,7 @@ class CertManager(cert_manager.CertManager):
|
|||||||
:param lb_id: Loadbalancer id for building resource consumer URL
|
:param lb_id: Loadbalancer id for building resource consumer URL
|
||||||
:param check_only: Read Certificate data without registering
|
:param check_only: Read Certificate data without registering
|
||||||
|
|
||||||
:return: octavia.certificates.common.Cert representation of the
|
:returns: octavia.certificates.common.Cert representation of the
|
||||||
certificate data
|
certificate data
|
||||||
:raises Exception: if certificate retrieval fails
|
:raises Exception: if certificate retrieval fails
|
||||||
"""
|
"""
|
||||||
|
@ -117,7 +117,7 @@ class CertManager(cert_manager.CertManager):
|
|||||||
|
|
||||||
:param cert_ref: the UUID of the cert to retrieve
|
:param cert_ref: the UUID of the cert to retrieve
|
||||||
|
|
||||||
:return: neutron_lbaas.common.cert_manager.cert_manager.Cert
|
:returns: neutron_lbaas.common.cert_manager.cert_manager.Cert
|
||||||
representation of the certificate data
|
representation of the certificate data
|
||||||
:raises CertificateStorageException: if certificate retrieval fails
|
:raises CertificateStorageException: if certificate retrieval fails
|
||||||
"""
|
"""
|
||||||
|
@ -79,7 +79,7 @@ cfg.CONF.register_opts(OPTS, 'service_auth')
|
|||||||
def get_session():
|
def get_session():
|
||||||
"""Initializes a Keystone session.
|
"""Initializes a Keystone session.
|
||||||
|
|
||||||
:return: a Keystone Session object
|
:returns: a Keystone Session object
|
||||||
:raises Exception: if the session cannot be established
|
:raises Exception: if the session cannot be established
|
||||||
"""
|
"""
|
||||||
global _SESSION
|
global _SESSION
|
||||||
|
@ -115,7 +115,7 @@ def dump_private_key(private_key, private_key_passphrase=None):
|
|||||||
|
|
||||||
:param private_key: private key
|
:param private_key: private key
|
||||||
:param private_key_passphrase: private key passphrase
|
:param private_key_passphrase: private key passphrase
|
||||||
:return: Unencrypted private key in PKCS8
|
:returns: Unencrypted private key in PKCS8
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# re encode the key as unencrypted PKCS8
|
# re encode the key as unencrypted PKCS8
|
||||||
|
@ -162,7 +162,7 @@ class HaproxyNSDriver(agent_device_driver.AgentDeviceDriver):
|
|||||||
def deploy_instance(self, loadbalancer):
|
def deploy_instance(self, loadbalancer):
|
||||||
"""Deploys loadbalancer if necessary
|
"""Deploys loadbalancer if necessary
|
||||||
|
|
||||||
:return: True if loadbalancer was deployed, False otherwise
|
:returns: True if loadbalancer was deployed, False otherwise
|
||||||
"""
|
"""
|
||||||
if not self.deployable(loadbalancer):
|
if not self.deployable(loadbalancer):
|
||||||
LOG.info(_LI("Loadbalancer %s is not deployable.") %
|
LOG.info(_LI("Loadbalancer %s is not deployable.") %
|
||||||
|
@ -93,7 +93,7 @@ def save_config(conf_path, loadbalancer, socket_path, user_group,
|
|||||||
def _get_template():
|
def _get_template():
|
||||||
"""Retrieve Jinja template
|
"""Retrieve Jinja template
|
||||||
|
|
||||||
:return: Jinja template
|
:returns: Jinja template
|
||||||
"""
|
"""
|
||||||
global JINJA_ENV
|
global JINJA_ENV
|
||||||
if not JINJA_ENV:
|
if not JINJA_ENV:
|
||||||
@ -111,7 +111,7 @@ def _store_listener_crt(haproxy_base_dir, listener, cert):
|
|||||||
:param haproxy_base_dir: location of the instances state data
|
:param haproxy_base_dir: location of the instances state data
|
||||||
:param listener: the listener object
|
:param listener: the listener object
|
||||||
:param cert: the TLS certificate
|
:param cert: the TLS certificate
|
||||||
:return: location of the stored certificate
|
:returns: location of the stored certificate
|
||||||
"""
|
"""
|
||||||
cert_path = _retrieve_crt_path(haproxy_base_dir, listener,
|
cert_path = _retrieve_crt_path(haproxy_base_dir, listener,
|
||||||
cert.primary_cn)
|
cert.primary_cn)
|
||||||
@ -127,7 +127,7 @@ def _retrieve_crt_path(haproxy_base_dir, listener, primary_cn):
|
|||||||
:param haproxy_base_dir: location of the instances state data
|
:param haproxy_base_dir: location of the instances state data
|
||||||
:param listener: the listener object
|
:param listener: the listener object
|
||||||
:param primary_cn: primary_cn used for identifying TLS certificate
|
:param primary_cn: primary_cn used for identifying TLS certificate
|
||||||
:return: TLS certificate location
|
:returns: TLS certificate location
|
||||||
"""
|
"""
|
||||||
confs_dir = os.path.abspath(os.path.normpath(haproxy_base_dir))
|
confs_dir = os.path.abspath(os.path.normpath(haproxy_base_dir))
|
||||||
confs_path = os.path.join(confs_dir, listener.id)
|
confs_path = os.path.join(confs_dir, listener.id)
|
||||||
@ -143,8 +143,8 @@ def _process_tls_certificates(listener):
|
|||||||
|
|
||||||
Converts and uploads PEM data to the Amphora API
|
Converts and uploads PEM data to the Amphora API
|
||||||
|
|
||||||
:param listener the listener object
|
:param listener: the listener object
|
||||||
:return: TLS_CERT and SNI_CERTS
|
:returns: TLS_CERT and SNI_CERTS
|
||||||
"""
|
"""
|
||||||
cert_mgr = CERT_MANAGER_PLUGIN.CertManager()
|
cert_mgr = CERT_MANAGER_PLUGIN.CertManager()
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ def _get_primary_cn(tls_cert):
|
|||||||
"""Retrieve primary cn for TLS certificate
|
"""Retrieve primary cn for TLS certificate
|
||||||
|
|
||||||
:param tls_cert: the TLS certificate
|
:param tls_cert: the TLS certificate
|
||||||
:return: primary cn of the TLS certificate
|
:returns: primary cn of the TLS certificate
|
||||||
"""
|
"""
|
||||||
return cert_parser.get_host_names(tls_cert)['cn']
|
return cert_parser.get_host_names(tls_cert)['cn']
|
||||||
|
|
||||||
@ -179,7 +179,7 @@ def _map_cert_tls_container(cert):
|
|||||||
"""Map cert data to TLS data model
|
"""Map cert data to TLS data model
|
||||||
|
|
||||||
:param cert: TLS certificate
|
:param cert: TLS certificate
|
||||||
:return: mapped TLSContainer object
|
:returns: mapped TLSContainer object
|
||||||
"""
|
"""
|
||||||
certificate = cert.get_certificate()
|
certificate = cert.get_certificate()
|
||||||
pkey = cert_parser.dump_private_key(cert.get_private_key(),
|
pkey = cert_parser.dump_private_key(cert.get_private_key(),
|
||||||
@ -195,7 +195,7 @@ def _build_pem(tls_cert):
|
|||||||
"""Generate PEM encoded TLS certificate data
|
"""Generate PEM encoded TLS certificate data
|
||||||
|
|
||||||
:param tls_cert: TLS certificate
|
:param tls_cert: TLS certificate
|
||||||
:return: PEm encoded certificate data
|
:returns: PEm encoded certificate data
|
||||||
"""
|
"""
|
||||||
pem = ()
|
pem = ()
|
||||||
if tls_cert.intermediates:
|
if tls_cert.intermediates:
|
||||||
@ -216,7 +216,7 @@ def render_loadbalancer_obj(loadbalancer, user_group, socket_path,
|
|||||||
:param user_group: the user group
|
:param user_group: the user group
|
||||||
:param socket_path: location of the instances socket data
|
:param socket_path: location of the instances socket data
|
||||||
:param haproxy_base_dir: location of the instances state data
|
:param haproxy_base_dir: location of the instances state data
|
||||||
:return: rendered load balancer configuration
|
:returns: rendered load balancer configuration
|
||||||
"""
|
"""
|
||||||
loadbalancer = _transform_loadbalancer(loadbalancer, haproxy_base_dir)
|
loadbalancer = _transform_loadbalancer(loadbalancer, haproxy_base_dir)
|
||||||
return _get_template().render({'loadbalancer': loadbalancer,
|
return _get_template().render({'loadbalancer': loadbalancer,
|
||||||
@ -230,7 +230,7 @@ def _transform_loadbalancer(loadbalancer, haproxy_base_dir):
|
|||||||
|
|
||||||
:param loadbalancer: the load balancer object
|
:param loadbalancer: the load balancer object
|
||||||
:param haproxy_base_dir: location of the instances state data
|
:param haproxy_base_dir: location of the instances state data
|
||||||
:return: dictionary of transformed load balancer values
|
:returns: dictionary of transformed load balancer values
|
||||||
"""
|
"""
|
||||||
listeners = [_transform_listener(
|
listeners = [_transform_listener(
|
||||||
x, haproxy_base_dir) for x in loadbalancer.listeners]
|
x, haproxy_base_dir) for x in loadbalancer.listeners]
|
||||||
@ -246,7 +246,7 @@ def _transform_listener(listener, haproxy_base_dir):
|
|||||||
|
|
||||||
:param listener: the listener object
|
:param listener: the listener object
|
||||||
:param haproxy_base_dir: location of the instances state data
|
:param haproxy_base_dir: location of the instances state data
|
||||||
:return: dictionary of transformed listener values
|
:returns: dictionary of transformed listener values
|
||||||
"""
|
"""
|
||||||
data_dir = os.path.join(haproxy_base_dir, listener.id)
|
data_dir = os.path.join(haproxy_base_dir, listener.id)
|
||||||
ret_value = {
|
ret_value = {
|
||||||
@ -276,7 +276,7 @@ def _transform_pool(pool):
|
|||||||
"""Transforms pool object
|
"""Transforms pool object
|
||||||
|
|
||||||
:param pool: the pool object
|
:param pool: the pool object
|
||||||
:return: dictionary of transformed pool values
|
:returns: dictionary of transformed pool values
|
||||||
"""
|
"""
|
||||||
ret_value = {
|
ret_value = {
|
||||||
'id': pool.id,
|
'id': pool.id,
|
||||||
@ -304,7 +304,7 @@ def _transform_session_persistence(persistence):
|
|||||||
"""Transforms session persistence object
|
"""Transforms session persistence object
|
||||||
|
|
||||||
:param persistence: the session persistence object
|
:param persistence: the session persistence object
|
||||||
:return: dictionary of transformed session persistence values
|
:returns: dictionary of transformed session persistence values
|
||||||
"""
|
"""
|
||||||
return {
|
return {
|
||||||
'type': persistence.type,
|
'type': persistence.type,
|
||||||
@ -316,7 +316,7 @@ def _transform_member(member):
|
|||||||
"""Transforms member object
|
"""Transforms member object
|
||||||
|
|
||||||
:param member: the member object
|
:param member: the member object
|
||||||
:return: dictionary of transformed member values
|
:returns: dictionary of transformed member values
|
||||||
"""
|
"""
|
||||||
return {
|
return {
|
||||||
'id': member.id,
|
'id': member.id,
|
||||||
@ -333,7 +333,7 @@ def _transform_health_monitor(monitor):
|
|||||||
"""Transforms health monitor object
|
"""Transforms health monitor object
|
||||||
|
|
||||||
:param monitor: the health monitor object
|
:param monitor: the health monitor object
|
||||||
:return: dictionary of transformed health monitor values
|
:returns: dictionary of transformed health monitor values
|
||||||
"""
|
"""
|
||||||
return {
|
return {
|
||||||
'id': monitor.id,
|
'id': monitor.id,
|
||||||
@ -353,7 +353,7 @@ def _include_member(member):
|
|||||||
"""Helper for verifying member statues
|
"""Helper for verifying member statues
|
||||||
|
|
||||||
:param member: the member object
|
:param member: the member object
|
||||||
:return: boolean of status check
|
:returns: boolean of status check
|
||||||
"""
|
"""
|
||||||
return (member.provisioning_status in
|
return (member.provisioning_status in
|
||||||
MEMBER_STATUSES and member.admin_state_up)
|
MEMBER_STATUSES and member.admin_state_up)
|
||||||
@ -363,7 +363,7 @@ def _expand_expected_codes(codes):
|
|||||||
"""Expand the expected code string in set of codes
|
"""Expand the expected code string in set of codes
|
||||||
|
|
||||||
:param codes: string of status codes
|
:param codes: string of status codes
|
||||||
:return: list of status codes
|
:returns: list of status codes
|
||||||
"""
|
"""
|
||||||
|
|
||||||
retval = set()
|
retval = set()
|
||||||
|
@ -325,7 +325,7 @@ class HaproxyNSDriver(agent_device_driver.AgentDeviceDriver):
|
|||||||
def deploy_instance(self, logical_config):
|
def deploy_instance(self, logical_config):
|
||||||
"""Deploys loadbalancer if necessary
|
"""Deploys loadbalancer if necessary
|
||||||
|
|
||||||
:return: True if loadbalancer was deployed, False otherwise
|
:returns: True if loadbalancer was deployed, False otherwise
|
||||||
"""
|
"""
|
||||||
# do actual deploy only if vip and pool are configured and active
|
# do actual deploy only if vip and pool are configured and active
|
||||||
if not logical_config or not self._is_active(logical_config):
|
if not logical_config or not self._is_active(logical_config):
|
||||||
|
@ -101,14 +101,14 @@ class CredentialProvider(object):
|
|||||||
def __init__(self, identity_version=None, name=None, password='pass',
|
def __init__(self, identity_version=None, name=None, password='pass',
|
||||||
network_resources=None):
|
network_resources=None):
|
||||||
"""A CredentialProvider supplies credentials to test classes.
|
"""A CredentialProvider supplies credentials to test classes.
|
||||||
:param identity_version If specified it will return credentials of the
|
:param identity_version: If specified it will return credentials of the
|
||||||
corresponding identity version, otherwise it
|
corresponding identity version, otherwise it
|
||||||
uses auth_version from configuration
|
uses auth_version from configuration
|
||||||
:param name Name of the calling test. Included in provisioned
|
:param name: Name of the calling test. Included in provisioned
|
||||||
credentials when credentials are provisioned on the fly
|
credentials when credentials are provisioned on the fly
|
||||||
:param password Used for provisioned credentials when credentials are
|
:param password: Used for provisioned credentials when credentials are
|
||||||
provisioned on the fly
|
provisioned on the fly
|
||||||
:param network_resources Network resources required for the credentials
|
:param network_resources: Network resources required for the credentials
|
||||||
"""
|
"""
|
||||||
# TODO(andreaf) name and password are tenant isolation specific, and
|
# TODO(andreaf) name and password are tenant isolation specific, and
|
||||||
# could be removed from this abstract class
|
# could be removed from this abstract class
|
||||||
|
@ -30,7 +30,7 @@ def get_network_from_name(name, compute_networks_client):
|
|||||||
:param str name: the name of the network to use
|
:param str name: the name of the network to use
|
||||||
:param NetworksClientJSON compute_networks_client: The network client
|
:param NetworksClientJSON compute_networks_client: The network client
|
||||||
object to use for making the network lists api request
|
object to use for making the network lists api request
|
||||||
:return: The full dictionary for the network in question
|
:returns: The full dictionary for the network in question
|
||||||
:rtype: dict
|
:rtype: dict
|
||||||
:raises InvalidConfiguration: If the name provided is invalid, the networks
|
:raises InvalidConfiguration: If the name provided is invalid, the networks
|
||||||
list returns a 404, there are no found networks, or the found network
|
list returns a 404, there are no found networks, or the found network
|
||||||
@ -95,7 +95,7 @@ def get_tenant_network(creds_provider, compute_networks_client):
|
|||||||
neutron and nova-network cases. If this is not an admin network
|
neutron and nova-network cases. If this is not an admin network
|
||||||
client, set_network_kwargs might fail in case fixed_network_name
|
client, set_network_kwargs might fail in case fixed_network_name
|
||||||
is the network to be used, and it's not visible to the tenant
|
is the network to be used, and it's not visible to the tenant
|
||||||
:return a dict with 'id' and 'name' of the network
|
:returns: a dict with 'id' and 'name' of the network
|
||||||
"""
|
"""
|
||||||
caller = misc_utils.find_test_caller()
|
caller = misc_utils.find_test_caller()
|
||||||
fixed_network_name = CONF.compute.fixed_network_name
|
fixed_network_name = CONF.compute.fixed_network_name
|
||||||
@ -125,7 +125,7 @@ def set_networks_kwarg(network, kwargs=None):
|
|||||||
|
|
||||||
:param network: dict of network to be used with 'id' and 'name'
|
:param network: dict of network to be used with 'id' and 'name'
|
||||||
:param kwargs: server create kwargs to be enhanced
|
:param kwargs: server create kwargs to be enhanced
|
||||||
:return: new dict of kwargs updated to include networks
|
:returns: new dict of kwargs updated to include networks
|
||||||
"""
|
"""
|
||||||
params = copy.copy(kwargs) or {}
|
params = copy.copy(kwargs) or {}
|
||||||
if kwargs and 'networks' in kwargs:
|
if kwargs and 'networks' in kwargs:
|
||||||
|
@ -91,7 +91,7 @@ class BotoClientBase(object):
|
|||||||
"""
|
"""
|
||||||
Obtain existing, or create new AWS credentials
|
Obtain existing, or create new AWS credentials
|
||||||
:param identity_client: identity client with embedded credentials
|
:param identity_client: identity client with embedded credentials
|
||||||
:return: EC2 credentials
|
:returns: EC2 credentials
|
||||||
"""
|
"""
|
||||||
ec2_cred_list = identity_client.list_user_ec2_credentials(
|
ec2_cred_list = identity_client.list_user_ec2_credentials(
|
||||||
identity_client.user_id)
|
identity_client.user_id)
|
||||||
|
@ -463,7 +463,7 @@ class BaseTestCase(testtools.testcase.WithAttributes,
|
|||||||
:param credential_type: string - primary, alt or admin
|
:param credential_type: string - primary, alt or admin
|
||||||
:param roles: list of roles
|
:param roles: list of roles
|
||||||
|
|
||||||
:returns the created client manager
|
:returns: the created client manager
|
||||||
:raises skipException: if the requested credentials are not available
|
:raises skipException: if the requested credentials are not available
|
||||||
"""
|
"""
|
||||||
if all([roles, credential_type]):
|
if all([roles, credential_type]):
|
||||||
@ -565,7 +565,7 @@ class BaseTestCase(testtools.testcase.WithAttributes,
|
|||||||
def get_tenant_network(cls):
|
def get_tenant_network(cls):
|
||||||
"""Get the network to be used in testing
|
"""Get the network to be used in testing
|
||||||
|
|
||||||
:return: network dict including 'id' and 'name'
|
:returns: network dict including 'id' and 'name'
|
||||||
"""
|
"""
|
||||||
# Make sure isolated_creds exists and get a network client
|
# Make sure isolated_creds exists and get a network client
|
||||||
networks_client = cls.get_client_manager().networks_client
|
networks_client = cls.get_client_manager().networks_client
|
||||||
|
@ -594,7 +594,7 @@ class NetworkScenarioTest(ScenarioTest):
|
|||||||
|
|
||||||
def cidr_in_use(cidr, tenant_id):
|
def cidr_in_use(cidr, tenant_id):
|
||||||
"""
|
"""
|
||||||
:return True if subnet with cidr already exist in tenant
|
:returns: True if subnet with cidr already exist in tenant
|
||||||
False else
|
False else
|
||||||
"""
|
"""
|
||||||
cidr_in_use = self._list_subnets(tenant_id=tenant_id, cidr=cidr)
|
cidr_in_use = self._list_subnets(tenant_id=tenant_id, cidr=cidr)
|
||||||
|
@ -217,7 +217,7 @@ def _get_rsa_numbers(private_key, private_key_passphrase=None):
|
|||||||
|
|
||||||
:param private_key:
|
:param private_key:
|
||||||
:param private_key_passphrase:
|
:param private_key_passphrase:
|
||||||
:return: a dictionary with keys (p,q,e,d,t,e,n)
|
:returns: a dictionary with keys (p,q,e,d,t,e,n)
|
||||||
"""
|
"""
|
||||||
kw = {"private_key_passphrase": private_key_passphrase}
|
kw = {"private_key_passphrase": private_key_passphrase}
|
||||||
pk = cert_parser._read_pyca_private_key(private_key, **kw)
|
pk = cert_parser._read_pyca_private_key(private_key, **kw)
|
||||||
|
Loading…
Reference in New Issue
Block a user