Fix H404/405 violations for service clients

There is a lot of H404/405 violations in Tempest now, and that leads
difficult to migrate the code to tempest-lib or the other projects'
repos. This patch fixes these violations for service clients.

Change-Id: Icf9f6fa4ea52a1fe72253391abf4880b1f8ed497
This commit is contained in:
Ken'ichi Ohmichi 2015-11-17 11:46:13 +00:00 committed by Ken'ichi Ohmichi
parent bf19dd1032
commit b279084f73
26 changed files with 107 additions and 191 deletions

View File

@ -40,10 +40,7 @@ def handle_errors(f):
class BaremetalClient(service_client.ServiceClient): class BaremetalClient(service_client.ServiceClient):
""" """Base Tempest REST client for Ironic API."""
Base Tempest REST client for Ironic API.
"""
uri_prefix = '' uri_prefix = ''
@ -58,8 +55,7 @@ class BaremetalClient(service_client.ServiceClient):
return json.loads(object_str) return json.loads(object_str)
def _get_uri(self, resource_name, uuid=None, permanent=False): def _get_uri(self, resource_name, uuid=None, permanent=False):
""" """Get URI for a specific resource or object.
Get URI for a specific resource or object.
:param resource_name: The name of the REST resource, e.g., 'nodes'. :param resource_name: The name of the REST resource, e.g., 'nodes'.
:param uuid: The unique identifier of an object in UUID format. :param uuid: The unique identifier of an object in UUID format.
@ -73,8 +69,7 @@ class BaremetalClient(service_client.ServiceClient):
uuid='/%s' % uuid if uuid else '') uuid='/%s' % uuid if uuid else '')
def _make_patch(self, allowed_attributes, **kw): def _make_patch(self, allowed_attributes, **kw):
""" """Create a JSON patch according to RFC 6902.
Create a JSON patch according to RFC 6902.
:param allowed_attributes: An iterable object that contains a set of :param allowed_attributes: An iterable object that contains a set of
allowed attributes for an object. allowed attributes for an object.
@ -103,8 +98,7 @@ class BaremetalClient(service_client.ServiceClient):
return patch return patch
def _list_request(self, resource, permanent=False, **kwargs): def _list_request(self, resource, permanent=False, **kwargs):
""" """Get the list of objects of the specified type.
Get the list of objects of the specified type.
:param resource: The name of the REST resource, e.g., 'nodes'. :param resource: The name of the REST resource, e.g., 'nodes'.
"param **kw: Parameters for the request. "param **kw: Parameters for the request.
@ -122,8 +116,7 @@ class BaremetalClient(service_client.ServiceClient):
return resp, self.deserialize(body) return resp, self.deserialize(body)
def _show_request(self, resource, uuid, permanent=False, **kwargs): def _show_request(self, resource, uuid, permanent=False, **kwargs):
""" """Gets a specific object of the specified type.
Gets a specific object of the specified type.
:param uuid: Unique identifier of the object in UUID format. :param uuid: Unique identifier of the object in UUID format.
:return: Serialized object as a dictionary. :return: Serialized object as a dictionary.
@ -139,8 +132,7 @@ class BaremetalClient(service_client.ServiceClient):
return resp, self.deserialize(body) return resp, self.deserialize(body)
def _create_request(self, resource, object_dict): def _create_request(self, resource, object_dict):
""" """Create an object of the specified type.
Create an object of the specified type.
:param resource: The name of the REST resource, e.g., 'nodes'. :param resource: The name of the REST resource, e.g., 'nodes'.
:param object_dict: A Python dict that represents an object of the :param object_dict: A Python dict that represents an object of the
@ -158,8 +150,7 @@ class BaremetalClient(service_client.ServiceClient):
return resp, self.deserialize(body) return resp, self.deserialize(body)
def _delete_request(self, resource, uuid): def _delete_request(self, resource, uuid):
""" """Delete specified object.
Delete specified object.
:param resource: The name of the REST resource, e.g., 'nodes'. :param resource: The name of the REST resource, e.g., 'nodes'.
:param uuid: The unique identifier of an object in UUID format. :param uuid: The unique identifier of an object in UUID format.
@ -173,8 +164,7 @@ class BaremetalClient(service_client.ServiceClient):
return resp, body return resp, body
def _patch_request(self, resource, uuid, patch_object): def _patch_request(self, resource, uuid, patch_object):
""" """Update specified object with JSON-patch.
Update specified object with JSON-patch.
:param resource: The name of the REST resource, e.g., 'nodes'. :param resource: The name of the REST resource, e.g., 'nodes'.
:param uuid: The unique identifier of an object in UUID format. :param uuid: The unique identifier of an object in UUID format.
@ -197,8 +187,7 @@ class BaremetalClient(service_client.ServiceClient):
@handle_errors @handle_errors
def get_version_description(self, version='v1'): def get_version_description(self, version='v1'):
""" """Retrieves the desctription of the API.
Retrieves the desctription of the API.
:param version: The version of the API. Default: 'v1'. :param version: The version of the API. Default: 'v1'.
:return: Serialized description of API resources. :return: Serialized description of API resources.
@ -207,10 +196,7 @@ class BaremetalClient(service_client.ServiceClient):
return self._list_request(version, permanent=True) return self._list_request(version, permanent=True)
def _put_request(self, resource, put_object): def _put_request(self, resource, put_object):
""" """Update specified object with JSON-patch."""
Update specified object with JSON-patch.
"""
uri = self._get_uri(resource) uri = self._get_uri(resource)
put_body = json.dumps(put_object) put_body = json.dumps(put_object)

View File

@ -14,9 +14,7 @@ from tempest.services.baremetal import base
class BaremetalClient(base.BaremetalClient): class BaremetalClient(base.BaremetalClient):
""" """Base Tempest REST client for Ironic API v1."""
Base Tempest REST client for Ironic API v1.
"""
version = '1' version = '1'
uri_prefix = 'v1' uri_prefix = 'v1'
@ -62,8 +60,7 @@ class BaremetalClient(base.BaremetalClient):
@base.handle_errors @base.handle_errors
def show_node(self, uuid): def show_node(self, uuid):
""" """Gets a specific node.
Gets a specific node.
:param uuid: Unique identifier of the node in UUID format. :param uuid: Unique identifier of the node in UUID format.
:return: Serialized node as a dictionary. :return: Serialized node as a dictionary.
@ -73,8 +70,7 @@ class BaremetalClient(base.BaremetalClient):
@base.handle_errors @base.handle_errors
def show_node_by_instance_uuid(self, instance_uuid): def show_node_by_instance_uuid(self, instance_uuid):
""" """Gets a node associated with given instance uuid.
Gets a node associated with given instance uuid.
:param uuid: Unique identifier of the node in UUID format. :param uuid: Unique identifier of the node in UUID format.
:return: Serialized node as a dictionary. :return: Serialized node as a dictionary.
@ -88,8 +84,7 @@ class BaremetalClient(base.BaremetalClient):
@base.handle_errors @base.handle_errors
def show_chassis(self, uuid): def show_chassis(self, uuid):
""" """Gets a specific chassis.
Gets a specific chassis.
:param uuid: Unique identifier of the chassis in UUID format. :param uuid: Unique identifier of the chassis in UUID format.
:return: Serialized chassis as a dictionary. :return: Serialized chassis as a dictionary.
@ -99,8 +94,7 @@ class BaremetalClient(base.BaremetalClient):
@base.handle_errors @base.handle_errors
def show_port(self, uuid): def show_port(self, uuid):
""" """Gets a specific port.
Gets a specific port.
:param uuid: Unique identifier of the port in UUID format. :param uuid: Unique identifier of the port in UUID format.
:return: Serialized port as a dictionary. :return: Serialized port as a dictionary.
@ -110,8 +104,7 @@ class BaremetalClient(base.BaremetalClient):
@base.handle_errors @base.handle_errors
def show_port_by_address(self, address): def show_port_by_address(self, address):
""" """Gets a specific port by address.
Gets a specific port by address.
:param address: MAC address of the port. :param address: MAC address of the port.
:return: Serialized port as a dictionary. :return: Serialized port as a dictionary.
@ -122,8 +115,7 @@ class BaremetalClient(base.BaremetalClient):
return self._show_request('ports', uuid=None, uri=uri) return self._show_request('ports', uuid=None, uri=uri)
def show_driver(self, driver_name): def show_driver(self, driver_name):
""" """Gets a specific driver.
Gets a specific driver.
:param driver_name: Name of driver. :param driver_name: Name of driver.
:return: Serialized driver as a dictionary. :return: Serialized driver as a dictionary.
@ -132,8 +124,7 @@ class BaremetalClient(base.BaremetalClient):
@base.handle_errors @base.handle_errors
def create_node(self, chassis_id=None, **kwargs): def create_node(self, chassis_id=None, **kwargs):
""" """Create a baremetal node with the specified parameters.
Create a baremetal node with the specified parameters.
:param cpu_arch: CPU architecture of the node. Default: x86_64. :param cpu_arch: CPU architecture of the node. Default: x86_64.
:param cpus: Number of CPUs. Default: 8. :param cpus: Number of CPUs. Default: 8.
@ -154,8 +145,7 @@ class BaremetalClient(base.BaremetalClient):
@base.handle_errors @base.handle_errors
def create_chassis(self, **kwargs): def create_chassis(self, **kwargs):
""" """Create a chassis with the specified parameters.
Create a chassis with the specified parameters.
:param description: The description of the chassis. :param description: The description of the chassis.
Default: test-chassis Default: test-chassis
@ -168,8 +158,7 @@ class BaremetalClient(base.BaremetalClient):
@base.handle_errors @base.handle_errors
def create_port(self, node_id, **kwargs): def create_port(self, node_id, **kwargs):
""" """Create a port with the specified parameters.
Create a port with the specified parameters.
:param node_id: The ID of the node which owns the port. :param node_id: The ID of the node which owns the port.
:param address: MAC address of the port. :param address: MAC address of the port.
@ -191,8 +180,7 @@ class BaremetalClient(base.BaremetalClient):
@base.handle_errors @base.handle_errors
def delete_node(self, uuid): def delete_node(self, uuid):
""" """Deletes a node having the specified UUID.
Deletes a node having the specified UUID.
:param uuid: The unique identifier of the node. :param uuid: The unique identifier of the node.
:return: A tuple with the server response and the response body. :return: A tuple with the server response and the response body.
@ -202,8 +190,7 @@ class BaremetalClient(base.BaremetalClient):
@base.handle_errors @base.handle_errors
def delete_chassis(self, uuid): def delete_chassis(self, uuid):
""" """Deletes a chassis having the specified UUID.
Deletes a chassis having the specified UUID.
:param uuid: The unique identifier of the chassis. :param uuid: The unique identifier of the chassis.
:return: A tuple with the server response and the response body. :return: A tuple with the server response and the response body.
@ -213,8 +200,7 @@ class BaremetalClient(base.BaremetalClient):
@base.handle_errors @base.handle_errors
def delete_port(self, uuid): def delete_port(self, uuid):
""" """Deletes a port having the specified UUID.
Deletes a port having the specified UUID.
:param uuid: The unique identifier of the port. :param uuid: The unique identifier of the port.
:return: A tuple with the server response and the response body. :return: A tuple with the server response and the response body.
@ -224,8 +210,7 @@ class BaremetalClient(base.BaremetalClient):
@base.handle_errors @base.handle_errors
def update_node(self, uuid, **kwargs): def update_node(self, uuid, **kwargs):
""" """Update the specified node.
Update the specified node.
:param uuid: The unique identifier of the node. :param uuid: The unique identifier of the node.
:return: A tuple with the server response and the updated node. :return: A tuple with the server response and the updated node.
@ -244,8 +229,7 @@ class BaremetalClient(base.BaremetalClient):
@base.handle_errors @base.handle_errors
def update_chassis(self, uuid, **kwargs): def update_chassis(self, uuid, **kwargs):
""" """Update the specified chassis.
Update the specified chassis.
:param uuid: The unique identifier of the chassis. :param uuid: The unique identifier of the chassis.
:return: A tuple with the server response and the updated chassis. :return: A tuple with the server response and the updated chassis.
@ -258,8 +242,7 @@ class BaremetalClient(base.BaremetalClient):
@base.handle_errors @base.handle_errors
def update_port(self, uuid, patch): def update_port(self, uuid, patch):
""" """Update the specified port.
Update the specified port.
:param uuid: The unique identifier of the port. :param uuid: The unique identifier of the port.
:param patch: List of dicts representing json patches. :param patch: List of dicts representing json patches.
@ -271,8 +254,7 @@ class BaremetalClient(base.BaremetalClient):
@base.handle_errors @base.handle_errors
def set_node_power_state(self, node_uuid, state): def set_node_power_state(self, node_uuid, state):
""" """Set power state of the specified node.
Set power state of the specified node.
:param node_uuid: The unique identifier of the node. :param node_uuid: The unique identifier of the node.
:state: desired state to set (on/off/reboot). :state: desired state to set (on/off/reboot).
@ -284,8 +266,7 @@ class BaremetalClient(base.BaremetalClient):
@base.handle_errors @base.handle_errors
def validate_driver_interface(self, node_uuid): def validate_driver_interface(self, node_uuid):
""" """Get all driver interfaces of a specific node.
Get all driver interfaces of a specific node.
:param uuid: Unique identifier of the node in UUID format. :param uuid: Unique identifier of the node in UUID format.
@ -300,8 +281,7 @@ class BaremetalClient(base.BaremetalClient):
@base.handle_errors @base.handle_errors
def set_node_boot_device(self, node_uuid, boot_device, persistent=False): def set_node_boot_device(self, node_uuid, boot_device, persistent=False):
""" """Set the boot device of the specified node.
Set the boot device of the specified node.
:param node_uuid: The unique identifier of the node. :param node_uuid: The unique identifier of the node.
:param boot_device: The boot device name. :param boot_device: The boot device name.
@ -318,8 +298,7 @@ class BaremetalClient(base.BaremetalClient):
@base.handle_errors @base.handle_errors
def get_node_boot_device(self, node_uuid): def get_node_boot_device(self, node_uuid):
""" """Get the current boot device of the specified node.
Get the current boot device of the specified node.
:param node_uuid: The unique identifier of the node. :param node_uuid: The unique identifier of the node.
@ -331,8 +310,7 @@ class BaremetalClient(base.BaremetalClient):
@base.handle_errors @base.handle_errors
def get_node_supported_boot_devices(self, node_uuid): def get_node_supported_boot_devices(self, node_uuid):
""" """Get the supported boot devices of the specified node.
Get the supported boot devices of the specified node.
:param node_uuid: The unique identifier of the node. :param node_uuid: The unique identifier of the node.
@ -344,8 +322,7 @@ class BaremetalClient(base.BaremetalClient):
@base.handle_errors @base.handle_errors
def get_console(self, node_uuid): def get_console(self, node_uuid):
""" """Get connection information about the console.
Get connection information about the console.
:param node_uuid: Unique identifier of the node in UUID format. :param node_uuid: Unique identifier of the node in UUID format.
@ -357,8 +334,7 @@ class BaremetalClient(base.BaremetalClient):
@base.handle_errors @base.handle_errors
def set_console_mode(self, node_uuid, enabled): def set_console_mode(self, node_uuid, enabled):
""" """Start and stop the node console.
Start and stop the node console.
:param node_uuid: Unique identifier of the node in UUID format. :param node_uuid: Unique identifier of the node in UUID format.
:param enabled: Boolean value; whether to enable or disable the :param enabled: Boolean value; whether to enable or disable the

View File

@ -88,8 +88,8 @@ class BotoClientBase(object):
return self.connect_method(**self.connection_data) return self.connect_method(**self.connection_data)
def get_aws_credentials(self, identity_client): def get_aws_credentials(self, identity_client):
""" """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 :return: EC2 credentials
""" """

View File

@ -160,8 +160,8 @@ class ServersClient(service_client.ServiceClient):
return service_client.ResponseBody(resp, body) return service_client.ResponseBody(resp, body)
def delete_password(self, server_id): def delete_password(self, server_id):
""" """Removes the encrypted server password from the metadata server
Removes the encrypted server password from the metadata server
Note that this does not actually change the instance server Note that this does not actually change the instance server
password. password.
""" """
@ -177,6 +177,7 @@ class ServersClient(service_client.ServiceClient):
def rebuild_server(self, server_id, image_ref, **kwargs): def rebuild_server(self, server_id, image_ref, **kwargs):
"""Rebuilds a server with a new image. """Rebuilds a server with a new image.
Most parameters except the following are passed to the API without Most parameters except the following are passed to the API without
any changes. any changes.
:param disk_config: The name is changed to OS-DCF:diskConfig :param disk_config: The name is changed to OS-DCF:diskConfig
@ -193,6 +194,7 @@ class ServersClient(service_client.ServiceClient):
def resize_server(self, server_id, flavor_ref, **kwargs): def resize_server(self, server_id, flavor_ref, **kwargs):
"""Changes the flavor of a server. """Changes the flavor of a server.
Most parameters except the following are passed to the API without Most parameters except the following are passed to the API without
any changes. any changes.
:param disk_config: The name is changed to OS-DCF:diskConfig :param disk_config: The name is changed to OS-DCF:diskConfig
@ -368,9 +370,7 @@ class ServersClient(service_client.ServiceClient):
**kwargs) **kwargs)
def list_virtual_interfaces(self, server_id): def list_virtual_interfaces(self, server_id):
""" """List the virtual interfaces used in an instance."""
List the virtual interfaces used in an instance.
"""
resp, body = self.get('/'.join(['servers', server_id, resp, body = self.get('/'.join(['servers', server_id,
'os-virtual-interfaces'])) 'os-virtual-interfaces']))
body = json.loads(body) body = json.loads(body)

View File

@ -20,8 +20,7 @@ from tempest.common import service_client
class DataProcessingClient(service_client.ServiceClient): class DataProcessingClient(service_client.ServiceClient):
def _request_and_check_resp(self, request_func, uri, resp_status): def _request_and_check_resp(self, request_func, uri, resp_status):
"""Make a request using specified request_func and check response """Make a request and check response status code.
status code.
It returns a ResponseBody. It returns a ResponseBody.
""" """
@ -30,8 +29,7 @@ class DataProcessingClient(service_client.ServiceClient):
return service_client.ResponseBody(resp, body) return service_client.ResponseBody(resp, body)
def _request_and_check_resp_data(self, request_func, uri, resp_status): def _request_and_check_resp_data(self, request_func, uri, resp_status):
"""Make a request using specified request_func and check response """Make a request and check response status code.
status code.
It returns pair: resp and response data. It returns pair: resp and response data.
""" """
@ -41,8 +39,7 @@ class DataProcessingClient(service_client.ServiceClient):
def _request_check_and_parse_resp(self, request_func, uri, def _request_check_and_parse_resp(self, request_func, uri,
resp_status, *args, **kwargs): resp_status, *args, **kwargs):
"""Make a request using specified request_func, check response status """Make a request, check response status code and parse response body.
code and parse response body.
It returns a ResponseBody. It returns a ResponseBody.
""" """

View File

@ -46,8 +46,8 @@ class IdentityClient(service_client.ServiceClient):
return service_client.ResponseBody(resp, body) return service_client.ResponseBody(resp, body)
def create_tenant(self, name, **kwargs): def create_tenant(self, name, **kwargs):
""" """Create a tenant
Create a tenant
name (required): New tenant name name (required): New tenant name
description: Description of new tenant (default is none) description: Description of new tenant (default is none)
enabled <true|false>: Initial tenant status (default is true) enabled <true|false>: Initial tenant status (default is true)

View File

@ -18,9 +18,10 @@ from tempest.common import service_client
class BaseNetworkClient(service_client.ServiceClient): class BaseNetworkClient(service_client.ServiceClient):
""" """Base class for Tempest REST clients for Neutron.
Base class for Tempest REST clients for Neutron. Child classes use v2 of
the Neutron API, since the V1 API has been removed from the code base. Child classes use v2 of the Neutron API, since the V1 API has been
removed from the code base.
""" """
version = '2.0' version = '2.0'

View File

@ -21,9 +21,10 @@ from tempest.services.network.json import base
class NetworkClient(base.BaseNetworkClient): class NetworkClient(base.BaseNetworkClient):
""" """Tempest REST client for Neutron.
Tempest REST client for Neutron. Uses v2 of the Neutron API, since the
V1 API has been removed from the code base. Uses v2 of the Neutron API, since the V1 API has been removed from the
code base.
Implements create, delete, update, list and show for the basic Neutron Implements create, delete, update, list and show for the basic Neutron
abstractions (networks, sub-networks, routers, ports and floating IP): abstractions (networks, sub-networks, routers, ports and floating IP):
@ -177,8 +178,8 @@ class NetworkClient(base.BaseNetworkClient):
def wait_for_resource_status(self, fetch, status, interval=None, def wait_for_resource_status(self, fetch, status, interval=None,
timeout=None): timeout=None):
""" """Waits for a network resource to reach a status
@summary: Waits for a network resource to reach a status
@param fetch: the callable to be used to query the resource status @param fetch: the callable to be used to query the resource status
@type fecth: callable that takes no parameters and returns the resource @type fecth: callable that takes no parameters and returns the resource
@param status: the status that the resource has to reach @param status: the status that the resource has to reach
@ -313,7 +314,8 @@ class NetworkClient(base.BaseNetworkClient):
return self.list_resources(uri) return self.list_resources(uri)
def update_agent(self, agent_id, agent_info): def update_agent(self, agent_id, agent_info):
""" """Update agent
:param agent_info: Agent update information. :param agent_info: Agent update information.
E.g {"admin_state_up": True} E.g {"admin_state_up": True}
""" """

View File

@ -19,10 +19,7 @@ import six
class AttributeDict(dict): class AttributeDict(dict):
"""Provide attribute access (dict.key) to dictionary values."""
"""
Provide attribute access (dict.key) to dictionary values.
"""
def __getattr__(self, name): def __getattr__(self, name):
"""Allow attribute access for all keys in the dict.""" """Allow attribute access for all keys in the dict."""
@ -33,10 +30,9 @@ class AttributeDict(dict):
@six.add_metaclass(abc.ABCMeta) @six.add_metaclass(abc.ABCMeta)
class DeletableResource(AttributeDict): class DeletableResource(AttributeDict):
"""Support deletion of neutron resources (networks, subnets)
""" via a delete() method, as is supported by keystone and nova resources.
Support deletion of neutron resources (networks, subnets) via a
delete() method, as is supported by keystone and nova resources.
""" """
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):

View File

@ -59,8 +59,8 @@ class AccountClient(service_client.ServiceClient):
return resp, body return resp, body
def list_account_metadata(self): def list_account_metadata(self):
""" """HEAD on the storage URL
HEAD on the storage URL
Returns all account metadata headers Returns all account metadata headers
""" """
resp, body = self.head('') resp, body = self.head('')
@ -86,9 +86,7 @@ class AccountClient(service_client.ServiceClient):
def delete_account_metadata(self, metadata, def delete_account_metadata(self, metadata,
metadata_prefix='X-Remove-Account-Meta-'): metadata_prefix='X-Remove-Account-Meta-'):
""" """Deletes an account metadata entry."""
Deletes an account metadata entry.
"""
headers = {} headers = {}
for item in metadata: for item in metadata:
@ -103,9 +101,7 @@ class AccountClient(service_client.ServiceClient):
delete_metadata=None, delete_metadata=None,
create_metadata_prefix='X-Account-Meta-', create_metadata_prefix='X-Account-Meta-',
delete_metadata_prefix='X-Remove-Account-Meta-'): delete_metadata_prefix='X-Remove-Account-Meta-'):
""" """Creates and deletes an account metadata entry."""
Creates and deletes an account metadata entry.
"""
headers = {} headers = {}
for key in create_metadata: for key in create_metadata:
headers[create_metadata_prefix + key] = create_metadata[key] headers[create_metadata_prefix + key] = create_metadata[key]
@ -117,8 +113,8 @@ class AccountClient(service_client.ServiceClient):
return resp, body return resp, body
def list_account_containers(self, params=None): def list_account_containers(self, params=None):
""" """GET on the (base) storage URL
GET on the (base) storage URL
Given valid X-Auth-Token, returns a list of all containers for the Given valid X-Auth-Token, returns a list of all containers for the
account. account.

View File

@ -29,9 +29,9 @@ class ContainerClient(service_client.ServiceClient):
remove_metadata=None, remove_metadata=None,
metadata_prefix='X-Container-Meta-', metadata_prefix='X-Container-Meta-',
remove_metadata_prefix='X-Remove-Container-Meta-'): remove_metadata_prefix='X-Remove-Container-Meta-'):
""" """Creates a container
Creates a container, with optional metadata passed in as a
dictionary with optional metadata passed in as a dictionary
""" """
url = str(container_name) url = str(container_name)
headers = {} headers = {}
@ -90,19 +90,17 @@ class ContainerClient(service_client.ServiceClient):
return resp, body return resp, body
def list_container_metadata(self, container_name): def list_container_metadata(self, container_name):
""" """Retrieves container metadata headers"""
Retrieves container metadata headers
"""
url = str(container_name) url = str(container_name)
resp, body = self.head(url) resp, body = self.head(url)
self.expected_success(204, resp.status) self.expected_success(204, resp.status)
return resp, body return resp, body
def list_all_container_objects(self, container, params=None): def list_all_container_objects(self, container, params=None):
""" """Returns complete list of all objects in the container
Returns complete list of all objects in the container, even if
item count is beyond 10,000 item listing limit. even if item count is beyond 10,000 item listing limit.
Does not require any parameters aside from container name. Does not require any parameters aside from container name.
""" """
# TODO(dwalleck): Rewrite using json format to avoid newlines at end of # TODO(dwalleck): Rewrite using json format to avoid newlines at end of
# obj names. Set limit to API limit - 1 (max returned items = 9999) # obj names. Set limit to API limit - 1 (max returned items = 9999)
@ -121,8 +119,7 @@ class ContainerClient(service_client.ServiceClient):
return objlist return objlist
def list_container_contents(self, container, params=None): def list_container_contents(self, container, params=None):
""" """List the objects in a container, given the container name
List the objects in a container, given the container name
Returns the container object listing as a plain text list, or as Returns the container object listing as a plain text list, or as
xml or json if that option is specified via the 'format' argument. xml or json if that option is specified via the 'format' argument.

View File

@ -149,9 +149,7 @@ class ObjectClient(service_client.ServiceClient):
return resp, body return resp, body
def put_object_with_chunk(self, container, name, contents, chunk_size): def put_object_with_chunk(self, container, name, contents, chunk_size):
""" """Put an object with Transfer-Encoding header"""
Put an object with Transfer-Encoding header
"""
if self.base_url is None: if self.base_url is None:
self._set_auth() self._set_auth()
@ -204,8 +202,8 @@ class ObjectClient(service_client.ServiceClient):
def put_object_connection(base_url, container, name, contents=None, def put_object_connection(base_url, container, name, contents=None,
chunk_size=65536, headers=None, query_string=None): chunk_size=65536, headers=None, query_string=None):
""" """Helper function to make connection to put object with httplib
Helper function to make connection to put object with httplib
:param base_url: base_url of an object client :param base_url: base_url of an object client
:param container: container name that the object is in :param container: container name that the object is in
:param name: object name to put :param name: object name to put

View File

@ -20,9 +20,7 @@ from tempest.common import service_client
class BaseVolumeHostsClient(service_client.ServiceClient): class BaseVolumeHostsClient(service_client.ServiceClient):
""" """Client class to send CRUD Volume Hosts API requests"""
Client class to send CRUD Volume Hosts API requests to a Cinder endpoint
"""
def list_hosts(self, params=None): def list_hosts(self, params=None):
"""Lists all hosts.""" """Lists all hosts."""
@ -38,6 +36,4 @@ class BaseVolumeHostsClient(service_client.ServiceClient):
class VolumeHostsClient(BaseVolumeHostsClient): class VolumeHostsClient(BaseVolumeHostsClient):
""" """Client class to send CRUD Volume Host API V1 requests"""
Client class to send CRUD Volume Host API V1 requests to a Cinder endpoint
"""

View File

@ -19,9 +19,7 @@ from tempest.common import service_client
class BaseVolumeQuotasClient(service_client.ServiceClient): class BaseVolumeQuotasClient(service_client.ServiceClient):
""" """Client class to send CRUD Volume Quotas API requests"""
Client class to send CRUD Volume Quotas API requests to a Cinder endpoint
"""
TYPE = "json" TYPE = "json"
@ -79,6 +77,4 @@ class BaseVolumeQuotasClient(service_client.ServiceClient):
class VolumeQuotasClient(BaseVolumeQuotasClient): class VolumeQuotasClient(BaseVolumeQuotasClient):
""" """Client class to send CRUD Volume Type API V1 requests"""
Client class to send CRUD Volume Type API V1 requests to a Cinder endpoint
"""

View File

@ -21,9 +21,7 @@ from tempest.common import service_client
class BaseVolumeTypesClient(service_client.ServiceClient): class BaseVolumeTypesClient(service_client.ServiceClient):
""" """Client class to send CRUD Volume Types API requests"""
Client class to send CRUD Volume Types API requests to a Cinder endpoint
"""
def is_resource_deleted(self, resource): def is_resource_deleted(self, resource):
# to use this method self.resource must be defined to respective value # to use this method self.resource must be defined to respective value
@ -69,8 +67,8 @@ class BaseVolumeTypesClient(service_client.ServiceClient):
return service_client.ResponseBody(resp, body) return service_client.ResponseBody(resp, body)
def create_volume_type(self, name, **kwargs): def create_volume_type(self, name, **kwargs):
""" """Creates a new Volume_type.
Creates a new Volume_type.
name(Required): Name of volume_type. name(Required): Name of volume_type.
Following optional keyword arguments are accepted: Following optional keyword arguments are accepted:
extra_specs: A dictionary of values to be used as extra_specs. extra_specs: A dictionary of values to be used as extra_specs.
@ -113,8 +111,8 @@ class BaseVolumeTypesClient(service_client.ServiceClient):
return service_client.ResponseBody(resp, body) return service_client.ResponseBody(resp, body)
def create_volume_type_extra_specs(self, vol_type_id, extra_spec): def create_volume_type_extra_specs(self, vol_type_id, extra_spec):
""" """Creates a new Volume_type extra spec.
Creates a new Volume_type extra spec.
vol_type_id: Id of volume_type. vol_type_id: Id of volume_type.
extra_specs: A dictionary of values to be used as extra_specs. extra_specs: A dictionary of values to be used as extra_specs.
""" """
@ -134,8 +132,8 @@ class BaseVolumeTypesClient(service_client.ServiceClient):
def update_volume_type_extra_specs(self, vol_type_id, extra_spec_name, def update_volume_type_extra_specs(self, vol_type_id, extra_spec_name,
extra_spec): extra_spec):
""" """Update a volume_type extra spec.
Update a volume_type extra spec.
vol_type_id: Id of volume_type. vol_type_id: Id of volume_type.
extra_spec_name: Name of the extra spec to be updated. extra_spec_name: Name of the extra spec to be updated.
extra_spec: A dictionary of with key as extra_spec_name and the extra_spec: A dictionary of with key as extra_spec_name and the
@ -150,8 +148,8 @@ class BaseVolumeTypesClient(service_client.ServiceClient):
return service_client.ResponseBody(resp, body) return service_client.ResponseBody(resp, body)
def show_encryption_type(self, vol_type_id): def show_encryption_type(self, vol_type_id):
""" """Get the volume encryption type for the specified volume type.
Get the volume encryption type for the specified volume type.
vol_type_id: Id of volume_type. vol_type_id: Id of volume_type.
""" """
url = "/types/%s/encryption" % str(vol_type_id) url = "/types/%s/encryption" % str(vol_type_id)
@ -161,8 +159,7 @@ class BaseVolumeTypesClient(service_client.ServiceClient):
return service_client.ResponseBody(resp, body) return service_client.ResponseBody(resp, body)
def create_encryption_type(self, vol_type_id, **kwargs): def create_encryption_type(self, vol_type_id, **kwargs):
""" """Create a new encryption type for the specified volume type.
Create a new encryption type for the specified volume type.
vol_type_id: Id of volume_type. vol_type_id: Id of volume_type.
provider: Class providing encryption support. provider: Class providing encryption support.

View File

@ -28,6 +28,4 @@ class BaseVolumeAvailabilityZoneClient(service_client.ServiceClient):
class VolumeAvailabilityZoneClient(BaseVolumeAvailabilityZoneClient): class VolumeAvailabilityZoneClient(BaseVolumeAvailabilityZoneClient):
""" """Volume V1 availability zone client."""
Volume V1 availability zone client.
"""

View File

@ -24,9 +24,7 @@ from tempest import exceptions
class BaseBackupsClient(service_client.ServiceClient): class BaseBackupsClient(service_client.ServiceClient):
""" """Client class to send CRUD Volume backup API requests"""
Client class to send CRUD Volume backup API requests to a Cinder endpoint
"""
def create_backup(self, volume_id, container=None, name=None, def create_backup(self, volume_id, container=None, name=None,
description=None): description=None):

View File

@ -29,6 +29,4 @@ class BaseExtensionsClient(service_client.ServiceClient):
class ExtensionsClient(BaseExtensionsClient): class ExtensionsClient(BaseExtensionsClient):
""" """Volume V1 extensions client."""
Volume V1 extensions client.
"""

View File

@ -51,8 +51,8 @@ class BaseSnapshotsClient(service_client.ServiceClient):
return service_client.ResponseBody(resp, body) return service_client.ResponseBody(resp, body)
def create_snapshot(self, volume_id, **kwargs): def create_snapshot(self, volume_id, **kwargs):
""" """Creates a new snapshot.
Creates a new snapshot.
volume_id(Required): id of the volume. volume_id(Required): id of the volume.
force: Create a snapshot even if the volume attached (Default=False) force: Create a snapshot even if the volume attached (Default=False)
display_name: Optional snapshot Name. display_name: Optional snapshot Name.

View File

@ -23,9 +23,7 @@ from tempest.common import waiters
class BaseVolumesClient(service_client.ServiceClient): class BaseVolumesClient(service_client.ServiceClient):
""" """Base client class to send CRUD Volume API requests"""
Base client class to send CRUD Volume API requests to a Cinder endpoint
"""
create_resp = 200 create_resp = 200
@ -74,8 +72,8 @@ class BaseVolumesClient(service_client.ServiceClient):
return service_client.ResponseBody(resp, body) return service_client.ResponseBody(resp, body)
def create_volume(self, size=None, **kwargs): def create_volume(self, size=None, **kwargs):
""" """Creates a new Volume.
Creates a new Volume.
size: Size of volume in GB. size: Size of volume in GB.
Following optional keyword arguments are accepted: Following optional keyword arguments are accepted:
display_name: Optional Volume Name(only for V1). display_name: Optional Volume Name(only for V1).
@ -339,6 +337,4 @@ class BaseVolumesClient(service_client.ServiceClient):
class VolumesClient(BaseVolumesClient): class VolumesClient(BaseVolumesClient):
""" """Client class to send CRUD Volume V1 API requests"""
Client class to send CRUD Volume V1 API requests to a Cinder endpoint
"""

View File

@ -18,7 +18,5 @@ from tempest.services.volume.json.admin import volume_hosts_client
class VolumeHostsV2Client(volume_hosts_client.BaseVolumeHostsClient): class VolumeHostsV2Client(volume_hosts_client.BaseVolumeHostsClient):
""" """Client class to send CRUD Volume V2 API requests"""
Client class to send CRUD Volume V2 API requests to a Cinder endpoint
"""
api_version = "v2" api_version = "v2"

View File

@ -17,7 +17,5 @@ from tempest.services.volume.json.admin import volume_quotas_client
class VolumeQuotasV2Client(volume_quotas_client.BaseVolumeQuotasClient): class VolumeQuotasV2Client(volume_quotas_client.BaseVolumeQuotasClient):
""" """Client class to send CRUD Volume V2 API requests"""
Client class to send CRUD Volume V2 API requests to a Cinder endpoint
"""
api_version = "v2" api_version = "v2"

View File

@ -17,7 +17,5 @@ from tempest.services.volume.json.admin import volume_services_client as vs_cli
class VolumesServicesV2Client(vs_cli.BaseVolumesServicesClient): class VolumesServicesV2Client(vs_cli.BaseVolumesServicesClient):
""" """Client class to send CRUD Volume V2 API requests"""
Client class to send CRUD Volume V2 API requests to a Cinder endpoint
"""
api_version = "v2" api_version = "v2"

View File

@ -18,7 +18,5 @@ from tempest.services.volume.json.admin import volume_types_client
class VolumeTypesV2Client(volume_types_client.BaseVolumeTypesClient): class VolumeTypesV2Client(volume_types_client.BaseVolumeTypesClient):
""" """Client class to send CRUD Volume V2 API requests"""
Client class to send CRUD Volume V2 API requests to a Cinder endpoint
"""
api_version = "v2" api_version = "v2"

View File

@ -17,7 +17,5 @@ from tempest.services.volume.json import backups_client
class BackupsClientV2(backups_client.BaseBackupsClient): class BackupsClientV2(backups_client.BaseBackupsClient):
""" """Client class to send CRUD Volume V2 API requests"""
Client class to send CRUD Volume V2 API requests to a Cinder endpoint
"""
api_version = "v2" api_version = "v2"

View File

@ -17,8 +17,6 @@ from tempest.services.volume.json import volumes_client
class VolumesV2Client(volumes_client.BaseVolumesClient): class VolumesV2Client(volumes_client.BaseVolumesClient):
""" """Client class to send CRUD Volume V2 API requests"""
Client class to send CRUD Volume V2 API requests to a Cinder endpoint
"""
api_version = "v2" api_version = "v2"
create_resp = 202 create_resp = 202