From 94c3c68ca95259c51d8e034d715623fe8b192a4b Mon Sep 17 00:00:00 2001 From: Mathieu Le Marec - Pasquet Date: Sat, 1 Mar 2014 14:55:56 +0000 Subject: [PATCH] salt.cloud: race if item was removed in another loop --- salt/cloud/__init__.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/salt/cloud/__init__.py b/salt/cloud/__init__.py index af6b67c9f0..a777c26a2d 100644 --- a/salt/cloud/__init__.py +++ b/salt/cloud/__init__.py @@ -147,7 +147,7 @@ def enter_mainloop(target, iterable = [[queue, [arg], kwargs] for arg in mapped_args] ret = pool.map(func=target, iterable=iterable) else: - ret = pool.apply(target, [queue, args, kwargs]) + ret = pool.apply(target, [queue, args, kwargs]) while True: test = queue.get() if test in ['ERROR', 'KEYBOARDINT']: @@ -791,7 +791,8 @@ class Cloud(object): if driver not in processed[alias]: processed[alias][driver] = {} processed[alias][driver][name] = ret_multip[name] - names.remove(name) + if name in names: + names.remove(name) # not destroying in parallel else: @@ -808,7 +809,8 @@ class Cloud(object): if driver not in processed[alias]: processed[alias][driver] = {} processed[alias][driver][name] = ret - names.remove(name) + if name in names: + names.remove(name) # now the processed data structure contains the output from either # the parallel or non-parallel destroy and we should finish up