From 16340b7d346b75ebde5feb9379c64553ae557d4e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 14 Dec 2012 08:41:17 +0100 Subject: [PATCH] report on broken requirements, begin to satisfy requirements Signed-off-by: Nico Schottelius --- cdist/config_install.py | 18 ++++++++++++++++++ cdist/core/cdist_object.py | 4 ++++ 2 files changed, 22 insertions(+) diff --git a/cdist/config_install.py b/cdist/config_install.py index cab09b91..6a0d5161 100644 --- a/cdist/config_install.py +++ b/cdist/config_install.py @@ -143,6 +143,7 @@ class ConfigInstall(object): # - think about parallel execution (same for stage_prepare) # - catch unresolvable trees all_resolved = False + objects_changed = False while not all_resolved: all_resolved = True for cdist_object in objects: @@ -150,6 +151,23 @@ class ConfigInstall(object): all_resolved = False if cdist_object.satisfied_requirements: 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 diff --git a/cdist/core/cdist_object.py b/cdist/core/cdist_object.py index 90a21e59..cb34f521 100644 --- a/cdist/core/cdist_object.py +++ b/cdist/core/cdist_object.py @@ -209,3 +209,7 @@ class CdistObject(object): os.makedirs(absolute_parameter_path, exist_ok=False) except EnvironmentError as error: raise cdist.Error('Error creating directories for cdist object: %s: %s' % (self, error)) + + def satisfied_requirements(self): + +