From dbb9d4b7938f24ee588d260c9b51ca65d5095749 Mon Sep 17 00:00:00 2001 From: Christian Schwede Date: Mon, 27 Apr 2015 08:52:18 +0200 Subject: [PATCH] Add missing docstring in direct_client Added a missing docstring to the direct_delete_container method. Also checked other docstrings in the same file and fixed a wrong docstring element in direct_delete_object. Added raises: docstring entry to all methods that raise an Exception. Change-Id: If463a0f9ddff3fe2d13f6d97fcfa955e91d0f01f --- swift/common/direct_client.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/swift/common/direct_client.py b/swift/common/direct_client.py index 35ca24a64c..c95bc44128 100644 --- a/swift/common/direct_client.py +++ b/swift/common/direct_client.py @@ -153,6 +153,7 @@ def direct_head_container(node, part, account, container, conn_timeout=5, :param conn_timeout: timeout in seconds for establishing the connection :param response_timeout: timeout in seconds for getting the response :returns: a dict containing the response's headers in a HeaderKeyDict + :raises ClientException: HTTP HEAD request failed """ path = '/%s/%s' % (account, container) with Timeout(conn_timeout): @@ -200,6 +201,18 @@ def direct_get_container(node, part, account, container, marker=None, def direct_delete_container(node, part, account, container, conn_timeout=5, response_timeout=15, headers=None): + """ + Delete container directly from the container server. + + :param node: node dictionary from the ring + :param part: partition the container is on + :param account: account name + :param container: container name + :param conn_timeout: timeout in seconds for establishing the connection + :param response_timeout: timeout in seconds for getting the response + :param headers: dict to be passed into HTTPConnection headers + :raises ClientException: HTTP DELETE request failed + """ if headers is None: headers = {} @@ -274,6 +287,7 @@ def direct_head_object(node, part, account, container, obj, conn_timeout=5, :param response_timeout: timeout in seconds for getting the response :param headers: dict to be passed into HTTPConnection headers :returns: a dict containing the response's headers in a HeaderKeyDict + :raises ClientException: HTTP HEAD request failed """ if headers is None: headers = {} @@ -312,6 +326,7 @@ def direct_get_object(node, part, account, container, obj, conn_timeout=5, :param headers: dict to be passed into HTTPConnection headers :returns: a tuple of (response headers, the object's contents) The response headers will be a HeaderKeyDict. + :raises ClientException: HTTP GET request failed """ if headers is None: headers = {} @@ -363,6 +378,7 @@ def direct_put_object(node, part, account, container, name, contents, :param response_timeout: timeout in seconds for getting the response :param chunk_size: if defined, chunk size of data to send. :returns: etag from the server response + :raises ClientException: HTTP PUT request failed """ path = '/%s/%s/%s' % (account, container, name) @@ -462,7 +478,7 @@ def direct_delete_object(node, part, account, container, obj, :param obj: object name :param conn_timeout: timeout in seconds for establishing the connection :param response_timeout: timeout in seconds for getting the response - :returns: response from server + :raises ClientException: HTTP DELETE request failed """ if headers is None: headers = {} @@ -493,7 +509,8 @@ def retry(func, *args, **kwargs): :param kwargs: keyward arguments to send to func (if retries or error_log are sent, they will be deleted from kwargs before sending on to func) - :returns: restult of func + :returns: result of func + :raises ClientException: all retries failed """ retries = 5 if 'retries' in kwargs: