report on broken requirements, begin to satisfy requirements

Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
Nico Schottelius 2012-12-14 08:41:17 +01:00
parent 6b6037d9bb
commit 16340b7d34
2 changed files with 22 additions and 0 deletions

View file

@ -143,6 +143,7 @@ class ConfigInstall(object):
# - think about parallel execution (same for stage_prepare) # - think about parallel execution (same for stage_prepare)
# - catch unresolvable trees # - catch unresolvable trees
all_resolved = False all_resolved = False
objects_changed = False
while not all_resolved: while not all_resolved:
all_resolved = True all_resolved = True
for cdist_object in objects: for cdist_object in objects:
@ -150,6 +151,23 @@ class ConfigInstall(object):
all_resolved = False all_resolved = False
if cdist_object.satisfied_requirements: if cdist_object.satisfied_requirements:
self.object_run(cdist_object) self.object_run(cdist_object)
objects_changed = True
# Reran, but no object was solved
if not objects_changed:
# Create list of unfinished objects + their requirements for print
evil_objects = []
for cdist_object in objects:
if not cdist_object.state == cdist_object.STATE_DONE:
# evil_objects.append({ name: cdist_object.name,
# requirements: cdist_object.requirements,
# autorequire: cdist_object.autorequire })
evil_objects.append("%s (required: %s, autorequired: %s" %
(cdist_object.name, cdist_object.requirements, cdist_object.autorequire))
raise cdist.Error("Cannot solve requirements for the following objects: %s" %
(",".join(evil_objects)))
return return

View file

@ -209,3 +209,7 @@ class CdistObject(object):
os.makedirs(absolute_parameter_path, exist_ok=False) os.makedirs(absolute_parameter_path, exist_ok=False)
except EnvironmentError as error: except EnvironmentError as error:
raise cdist.Error('Error creating directories for cdist object: %s: %s' % (self, error)) raise cdist.Error('Error creating directories for cdist object: %s: %s' % (self, error))
def satisfied_requirements(self):