From b3337a18b9718fbaf4cda2424589d1bbfe49fe17 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 9 Nov 2011 18:30:12 +0100 Subject: [PATCH] in theory catch error when requiring an undefined object (in practise not) Error message trying to fix: ERROR: [Errno 2] No such file or directory: '/home/users/nico/.tmp/tmptvy1ic/out/object/__localch_yum_repos/singleton/.cdist/state' Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index c109e131..055a3b89 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -106,7 +106,7 @@ class ConfigInstall(object): """Run gencode and code for an object""" self.log.debug("Trying to run object " + cdist_object.name) if cdist_object.state == core.Object.STATE_RUNNING: - # FIXME: resolve dependency circle + # FIXME: resolve dependency circle / show problem source raise cdist.Error("Detected circular dependency in " + cdist_object.name) elif cdist_object.state == core.Object.STATE_DONE: self.log.debug("Ignoring run of already finished object %s", cdist_object) @@ -119,6 +119,13 @@ class ConfigInstall(object): for requirement in cdist_object.requirements: self.log.debug("Object %s requires %s", cdist_object, requirement) required_object = cdist_object.object_from_name(requirement) + + # The user may have created dependencies without satisfying them + if not required_object.exists(): + raise cdist.Error(cdist_object.name + " requires non-existing " + requirement.name) + else + self.log.debug("Required object %s exists", requirement.name) + self.object_run(required_object) # Generate