factor out iterate code to be able to test it for one, two, ... runs
Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
This commit is contained in:
parent
c5c5e7b89b
commit
b2686f3b13
1 changed files with 34 additions and 21 deletions
|
@ -75,12 +75,11 @@ class ConfigInstall(object):
|
||||||
self.context.local.type_path):
|
self.context.local.type_path):
|
||||||
yield cdist_object
|
yield cdist_object
|
||||||
|
|
||||||
def iterate_until_finished(self):
|
def iterate_once(self):
|
||||||
# Continue process until no new objects are created anymore
|
"""
|
||||||
|
Iterate over the objects once - helper method for
|
||||||
objects_changed = True
|
iterate_until_finished
|
||||||
|
"""
|
||||||
while objects_changed:
|
|
||||||
objects_changed = False
|
objects_changed = False
|
||||||
|
|
||||||
for cdist_object in self.object_list():
|
for cdist_object in self.object_list():
|
||||||
|
@ -102,6 +101,20 @@ class ConfigInstall(object):
|
||||||
self.object_run(cdist_object)
|
self.object_run(cdist_object)
|
||||||
objects_changed = True
|
objects_changed = True
|
||||||
|
|
||||||
|
return objects_changed
|
||||||
|
|
||||||
|
|
||||||
|
def iterate_until_finished(self):
|
||||||
|
"""
|
||||||
|
Go through all objects and solve them
|
||||||
|
one after another
|
||||||
|
"""
|
||||||
|
|
||||||
|
objects_changed = True
|
||||||
|
|
||||||
|
while objects_changed:
|
||||||
|
objects_changed = self.iterate_once()
|
||||||
|
|
||||||
# Check whether all objects have been finished
|
# Check whether all objects have been finished
|
||||||
unfinished_objects = []
|
unfinished_objects = []
|
||||||
for cdist_object in self.object_list():
|
for cdist_object in self.object_list():
|
||||||
|
|
Loading…
Reference in a new issue