metalsmith_instances: Handle an empty instance list

The dynamic concurrency change[1] causes an issue when the instance
list is empty because the thread pool is created with max_workers=0.

This change avoids this issue by exiting the provision function early
if the instances list is empty.

[1] https://review.opendev.org/#/c/714735/
Change-Id: I0d3587b575b0d32563ef24c7b1316c0b173a4268
This commit is contained in:
Steve Baker 2020-06-05 10:14:48 +12:00
parent 97a5e83565
commit 22e3522824
1 changed files with 3 additions and 0 deletions

View File

@ -235,6 +235,9 @@ def _release_nodes(provisioner, node_ids):
def provision(provisioner, instances, timeout, concurrency, clean_up, wait):
if not instances:
return False, []
# first, ensure all instances are reserved
reserve(provisioner, [i for i in instances if not i.get('name')], clean_up)