From 01968c3a8ddcc28d05009a437f43de618a1afc09 Mon Sep 17 00:00:00 2001 From: Bo Chi Date: Wed, 18 Nov 2015 06:11:12 -0500 Subject: [PATCH] Fix some inconsistency in docstrings Added colon after ":param" and changed ":return:" to ":returns:" according to http://docs.openstack.org/developer/hacking Change-Id: I210a4d88a18d9ddec367cd331f43e924068d6c63 --- .../cert_manager/barbican_cert_manager.py | 4 +-- .../common/cert_manager/local_cert_manager.py | 2 +- neutron_lbaas/common/keystone.py | 2 +- neutron_lbaas/common/tls_utils/cert_parser.py | 2 +- .../drivers/haproxy/namespace_driver.py | 2 +- .../loadbalancer/drivers/haproxy/jinja_cfg.py | 34 +++++++++---------- .../drivers/haproxy/namespace_driver.py | 2 +- .../tests/tempest/lib/common/cred_provider.py | 8 ++--- .../tests/tempest/lib/common/fixed_network.py | 6 ++-- .../tests/tempest/lib/services/botoclients.py | 2 +- neutron_lbaas/tests/tempest/lib/test.py | 4 +-- .../tests/tempest/v2/scenario/manager.py | 2 +- .../unit/common/tls_utils/test_cert_parser.py | 2 +- 13 files changed, 36 insertions(+), 36 deletions(-) diff --git a/neutron_lbaas/common/cert_manager/barbican_cert_manager.py b/neutron_lbaas/common/cert_manager/barbican_cert_manager.py index 1f24d177e..f86e2db78 100644 --- a/neutron_lbaas/common/cert_manager/barbican_cert_manager.py +++ b/neutron_lbaas/common/cert_manager/barbican_cert_manager.py @@ -64,7 +64,7 @@ class BarbicanKeystoneAuth(object): def get_barbican_client(cls): """Creates a Barbican client object. - :return: a Barbican Client object + :returns: a Barbican Client object :raises Exception: if the client cannot be created """ if not cls._barbican_client: @@ -178,7 +178,7 @@ class CertManager(cert_manager.CertManager): :param resource_ref: Full HATEOAS reference to the consuming resource :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 :raises Exception: if certificate retrieval fails """ diff --git a/neutron_lbaas/common/cert_manager/local_cert_manager.py b/neutron_lbaas/common/cert_manager/local_cert_manager.py index 7a71b65ab..b07ec0abd 100644 --- a/neutron_lbaas/common/cert_manager/local_cert_manager.py +++ b/neutron_lbaas/common/cert_manager/local_cert_manager.py @@ -117,7 +117,7 @@ class CertManager(cert_manager.CertManager): :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 :raises CertificateStorageException: if certificate retrieval fails """ diff --git a/neutron_lbaas/common/keystone.py b/neutron_lbaas/common/keystone.py index f7f8f3bb7..eec86c009 100644 --- a/neutron_lbaas/common/keystone.py +++ b/neutron_lbaas/common/keystone.py @@ -79,7 +79,7 @@ cfg.CONF.register_opts(OPTS, 'service_auth') def get_session(): """Initializes a Keystone session. - :return: a Keystone Session object + :returns: a Keystone Session object :raises Exception: if the session cannot be established """ global _SESSION diff --git a/neutron_lbaas/common/tls_utils/cert_parser.py b/neutron_lbaas/common/tls_utils/cert_parser.py index d741c5c13..71d565355 100644 --- a/neutron_lbaas/common/tls_utils/cert_parser.py +++ b/neutron_lbaas/common/tls_utils/cert_parser.py @@ -115,7 +115,7 @@ def dump_private_key(private_key, private_key_passphrase=None): :param private_key: private key :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 diff --git a/neutron_lbaas/drivers/haproxy/namespace_driver.py b/neutron_lbaas/drivers/haproxy/namespace_driver.py index fabf6ea35..fa4644c46 100644 --- a/neutron_lbaas/drivers/haproxy/namespace_driver.py +++ b/neutron_lbaas/drivers/haproxy/namespace_driver.py @@ -162,7 +162,7 @@ class HaproxyNSDriver(agent_device_driver.AgentDeviceDriver): def deploy_instance(self, loadbalancer): """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): LOG.info(_LI("Loadbalancer %s is not deployable.") % diff --git a/neutron_lbaas/services/loadbalancer/drivers/haproxy/jinja_cfg.py b/neutron_lbaas/services/loadbalancer/drivers/haproxy/jinja_cfg.py index 6ffffe6c0..3c33c421b 100644 --- a/neutron_lbaas/services/loadbalancer/drivers/haproxy/jinja_cfg.py +++ b/neutron_lbaas/services/loadbalancer/drivers/haproxy/jinja_cfg.py @@ -93,7 +93,7 @@ def save_config(conf_path, loadbalancer, socket_path, user_group, def _get_template(): """Retrieve Jinja template - :return: Jinja template + :returns: Jinja template """ global 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 listener: the listener object :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.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 listener: the listener object :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_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 - :param listener the listener object - :return: TLS_CERT and SNI_CERTS + :param listener: the listener object + :returns: TLS_CERT and SNI_CERTS """ cert_mgr = CERT_MANAGER_PLUGIN.CertManager() @@ -170,7 +170,7 @@ def _get_primary_cn(tls_cert): """Retrieve primary cn for 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'] @@ -179,7 +179,7 @@ def _map_cert_tls_container(cert): """Map cert data to TLS data model :param cert: TLS certificate - :return: mapped TLSContainer object + :returns: mapped TLSContainer object """ certificate = cert.get_certificate() 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 :param tls_cert: TLS certificate - :return: PEm encoded certificate data + :returns: PEm encoded certificate data """ pem = () if tls_cert.intermediates: @@ -216,7 +216,7 @@ def render_loadbalancer_obj(loadbalancer, user_group, socket_path, :param user_group: the user group :param socket_path: location of the instances socket 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) return _get_template().render({'loadbalancer': loadbalancer, @@ -230,7 +230,7 @@ def _transform_loadbalancer(loadbalancer, haproxy_base_dir): :param loadbalancer: the load balancer object :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( 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 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) ret_value = { @@ -276,7 +276,7 @@ def _transform_pool(pool): """Transforms pool object :param pool: the pool object - :return: dictionary of transformed pool values + :returns: dictionary of transformed pool values """ ret_value = { 'id': pool.id, @@ -304,7 +304,7 @@ def _transform_session_persistence(persistence): """Transforms session persistence object :param persistence: the session persistence object - :return: dictionary of transformed session persistence values + :returns: dictionary of transformed session persistence values """ return { 'type': persistence.type, @@ -316,7 +316,7 @@ def _transform_member(member): """Transforms member object :param member: the member object - :return: dictionary of transformed member values + :returns: dictionary of transformed member values """ return { 'id': member.id, @@ -333,7 +333,7 @@ def _transform_health_monitor(monitor): """Transforms health monitor object :param monitor: the health monitor object - :return: dictionary of transformed health monitor values + :returns: dictionary of transformed health monitor values """ return { 'id': monitor.id, @@ -353,7 +353,7 @@ def _include_member(member): """Helper for verifying member statues :param member: the member object - :return: boolean of status check + :returns: boolean of status check """ return (member.provisioning_status in 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 :param codes: string of status codes - :return: list of status codes + :returns: list of status codes """ retval = set() diff --git a/neutron_lbaas/services/loadbalancer/drivers/haproxy/namespace_driver.py b/neutron_lbaas/services/loadbalancer/drivers/haproxy/namespace_driver.py index 914d7cb0d..7c3ca521b 100644 --- a/neutron_lbaas/services/loadbalancer/drivers/haproxy/namespace_driver.py +++ b/neutron_lbaas/services/loadbalancer/drivers/haproxy/namespace_driver.py @@ -325,7 +325,7 @@ class HaproxyNSDriver(agent_device_driver.AgentDeviceDriver): def deploy_instance(self, logical_config): """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 if not logical_config or not self._is_active(logical_config): diff --git a/neutron_lbaas/tests/tempest/lib/common/cred_provider.py b/neutron_lbaas/tests/tempest/lib/common/cred_provider.py index 005d36ad5..ecfad83a5 100644 --- a/neutron_lbaas/tests/tempest/lib/common/cred_provider.py +++ b/neutron_lbaas/tests/tempest/lib/common/cred_provider.py @@ -101,14 +101,14 @@ class CredentialProvider(object): def __init__(self, identity_version=None, name=None, password='pass', network_resources=None): """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 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 - :param password Used for provisioned credentials when credentials are + :param password: Used for provisioned credentials when credentials are 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 # could be removed from this abstract class diff --git a/neutron_lbaas/tests/tempest/lib/common/fixed_network.py b/neutron_lbaas/tests/tempest/lib/common/fixed_network.py index ef1110a41..a7ece2016 100644 --- a/neutron_lbaas/tests/tempest/lib/common/fixed_network.py +++ b/neutron_lbaas/tests/tempest/lib/common/fixed_network.py @@ -30,7 +30,7 @@ def get_network_from_name(name, compute_networks_client): :param str name: the name of the network to use :param NetworksClientJSON compute_networks_client: The network client 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 :raises InvalidConfiguration: If the name provided is invalid, the networks 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 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 - :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() 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 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 {} if kwargs and 'networks' in kwargs: diff --git a/neutron_lbaas/tests/tempest/lib/services/botoclients.py b/neutron_lbaas/tests/tempest/lib/services/botoclients.py index d0fc11b4a..e36a8089c 100644 --- a/neutron_lbaas/tests/tempest/lib/services/botoclients.py +++ b/neutron_lbaas/tests/tempest/lib/services/botoclients.py @@ -91,7 +91,7 @@ class BotoClientBase(object): """ Obtain existing, or create new AWS credentials :param identity_client: identity client with embedded credentials - :return: EC2 credentials + :returns: EC2 credentials """ ec2_cred_list = identity_client.list_user_ec2_credentials( identity_client.user_id) diff --git a/neutron_lbaas/tests/tempest/lib/test.py b/neutron_lbaas/tests/tempest/lib/test.py index 8e62c3b28..611886899 100644 --- a/neutron_lbaas/tests/tempest/lib/test.py +++ b/neutron_lbaas/tests/tempest/lib/test.py @@ -463,7 +463,7 @@ class BaseTestCase(testtools.testcase.WithAttributes, :param credential_type: string - primary, alt or admin :param roles: list of roles - :returns the created client manager + :returns: the created client manager :raises skipException: if the requested credentials are not available """ if all([roles, credential_type]): @@ -565,7 +565,7 @@ class BaseTestCase(testtools.testcase.WithAttributes, def get_tenant_network(cls): """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 networks_client = cls.get_client_manager().networks_client diff --git a/neutron_lbaas/tests/tempest/v2/scenario/manager.py b/neutron_lbaas/tests/tempest/v2/scenario/manager.py index b5b71a892..2df12d1fc 100644 --- a/neutron_lbaas/tests/tempest/v2/scenario/manager.py +++ b/neutron_lbaas/tests/tempest/v2/scenario/manager.py @@ -594,7 +594,7 @@ class NetworkScenarioTest(ScenarioTest): 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 """ cidr_in_use = self._list_subnets(tenant_id=tenant_id, cidr=cidr) diff --git a/neutron_lbaas/tests/unit/common/tls_utils/test_cert_parser.py b/neutron_lbaas/tests/unit/common/tls_utils/test_cert_parser.py index ffccb6116..663df8549 100644 --- a/neutron_lbaas/tests/unit/common/tls_utils/test_cert_parser.py +++ b/neutron_lbaas/tests/unit/common/tls_utils/test_cert_parser.py @@ -217,7 +217,7 @@ def _get_rsa_numbers(private_key, private_key_passphrase=None): :param private_key: :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} pk = cert_parser._read_pyca_private_key(private_key, **kw)