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 <nico@brief.schottelius.org>
This commit is contained in:
Nico Schottelius 2011-11-09 18:30:12 +01:00
parent 45c9f629ae
commit b3337a18b9

View file

@ -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