LGTM, thanks

On Fri, Dec 20, 2013 at 10:09 AM, Hrvoje Ribicic <[email protected]> wrote:

> The earlier version of the Finish function assumed that checking if the
> value of the response is None would suffice to check if any errors have
> occurred. This is not, and this patch adjusts the function to expose
> the status already known within.
>
> Signed-off-by: Hrvoje Ribicic <[email protected]>
> ---
>  qa/rapi-workload.py | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/qa/rapi-workload.py b/qa/rapi-workload.py
> index 620e933..03d49a1 100755
> --- a/qa/rapi-workload.py
> +++ b/qa/rapi-workload.py
> @@ -175,6 +175,9 @@ def Finish(client, fn, *args, **kwargs):
>    @type fn function
>    @param fn A client method returning a job id.
>
> +  @rtype tuple of bool, any object
> +  @return The success status and the result of the operation, if any
> +
>    """
>    possible_job_id = fn(*args, **kwargs)
>    try:
> @@ -193,11 +196,11 @@ def Finish(client, fn, *args, **kwargs):
>
>    result = client.GetJobStatus(possible_job_id)["opresult"][0]
>    if success:
> -    return result
> +    return success, result
>    else:
>      print "Error encountered while performing operation: "
>      print result
> -    return None
> +    return success, None
>
>
>  def TestTags(client, get_fn, add_fn, delete_fn, *args):
> @@ -479,11 +482,11 @@ def TestNodeOperations(client, non_master_node):
>                         constants.ST_LVM_VG,
>                         constants.ST_FILE,
>                        ]:
> -    storage_units = Finish(client, client.GetNodeStorageUnits,
> -                           non_master_node, storage_type,
> -                           ",".join(storage_units_fields))
> +    success, storage_units = Finish(client, client.GetNodeStorageUnits,
> +                                    non_master_node, storage_type,
> +                                    ",".join(storage_units_fields))
>
> -    if len(storage_units) > 0 and len(storage_units[0]) > 0:
> +    if success and len(storage_units) > 0 and len(storage_units[0]) > 0:
>        # Name is the first entry of the first result, allocatable the other
>        unit_name = storage_units[0][0]
>        Finish(client, client.ModifyNodeStorageUnits,
> --
> 1.8.5.1
>
>


-- 
-- 
Helga Velroyen | Software Engineer | [email protected] |

Google Germany GmbH
Dienerstr. 12
80331 München

Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Graham Law, Christine Elizabeth Flores

Reply via email to