aptira / robotframework-openstacklibrary

OpenStack Library for Robot Framework
0 stars 2 forks source link

Check Stacks doesn't work if stack was only deployed once #1

Open eleanorcuallado opened 5 years ago

eleanorcuallado commented 5 years ago

My team and I are currently using OpenStack and want to use Robot Framework for the acceptance of our TripleO platform; while going through your code and trying simple tests, I realized that there seems to be a bug on the Check Stacks code :

                if str(stack.stack_name).startswith(stack_name+'-'):
                    total_stacks += 1
                    if stack.status == "COMPLETE":
                        completed_stacks += 1
                    elif stack.status == "FAILED":
                        failed_stacks += 1

In this piece of code, you can only check stacks that have been deployed at least twice, since you check that it starts with a dash; I believe you should start by checking if the stack name is contained in the list, and then run that loop, to make sure you get all use cases.

shundezhang commented 5 years ago

thanks for pointing this out, probably an easy fix is to change the first if clause to: if str(stack.stack_name) == stack_name or str(stack.stack_name).startswith(stack_name+'-'):

eleanorcuallado commented 5 years ago

It's what I did; I already had to modify a few things (using keystone v2, for instance, as well as adding a function here or there to complete the code); it was mostly for you and anyone else who wants to use this in the future.

Also, you should put a license on the code; it's then clearer regarding what we should do if we use a modifed version of your code :)