add new state code, begin to detect circular dependencies

Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
Nico Schottelius 2011-10-19 15:32:06 +02:00
parent ba6371c584
commit 0e7c532870
2 changed files with 6 additions and 7 deletions

View File

@ -204,7 +204,6 @@ if __name__ == "__main__":
log = logging.getLogger("cdist")
logging.basicConfig(format='%(levelname)s: %(message)s')
if re.match("__", os.path.basename(sys.argv[0])):

View File

@ -87,7 +87,7 @@ class ConfigInstall(object):
new_objects_created = False
for cdist_object in core.Object.list_objects(self.local.object_path,
self.local.type_path):
if cdist_object.prepared:
if cdist_object.state == cdist.core.object.STATE_PREPARED:
self.log.debug("Skipping re-prepare of object %s", cdist_object)
continue
else:
@ -121,18 +121,18 @@ class ConfigInstall(object):
self.log.info("Running manifest and explorers for " + cdist_object.name)
self.run_type_explorers(cdist_object)
self.manifest.run_type_manifest(cdist_object)
cdist_object.prepared = True
cdist_object.state = cdist.core.object.STATE_PREPARED
def object_run(self, cdist_object):
"""Run gencode and code for an object"""
self.log.info("Running gencode and code for " + cdist_object.name)
# Catch requirements, which re-call us
# FIXME: change .ran to running
if cdist_object.ran:
if cdist_object.state == cdist.core.object.STATE_RUNNING:
raise cdist.Error("Detected circular dependency in " + cdist_object.__str__())
elif cdist_object.state == cdist.core.object.STATE_DONE:
return
else:
cdist_object.ran = True
cdist_object.state = cdist.core.object.STATE_RUNNING
cdist_type = cdist_object.type