From ca3a8ddf67f060414ed3f065791821bd086c3267 Mon Sep 17 00:00:00 2001 From: Darko Poljak Date: Thu, 8 Dec 2016 00:47:07 +0100 Subject: [PATCH] no clear() in python < 3.3; if only one then do it sequentially --- cdist/config.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cdist/config.py b/cdist/config.py index f3faa03a..655153be 100644 --- a/cdist/config.py +++ b/cdist/config.py @@ -320,13 +320,16 @@ class Config(object): # objects_changed = True cargo.append(cdist_object) - if cargo: + if len(cargo) == 1: + self.object_prepare(cargo[0]) + objects_changed = True + elif cargo: with concurrent.futures.ProcessPoolExecutor(self.jobs) as executor: for x in executor.map(self.object_prepare, cargo): pass # returns None objects_changed = True - cargo.clear() + del cargo[:] for cdist_object in self.object_list(): if cdist_object.requirements_unfinished(cdist_object.requirements): """We cannot do anything for this poor object""" @@ -344,7 +347,10 @@ class Config(object): # objects_changed = True cargo.append(cdist_object) - if cargo: + if len(cargo) == 1: + self.object_run(cargo[0]) + objects_changed = True + elif cargo: with concurrent.futures.ProcessPoolExecutor(self.jobs) as executor: for x in executor.map(self.object_run, cargo): pass # returns None