add new state code, begin to detect circular dependencies

Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
remotes/origin/feature_files_export
Nico Schottelius 13 years ago
parent ba6371c584
commit 0e7c532870
  1. 1
      bin/cdist
  2. 12
      lib/cdist/config_install.py

@ -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])):

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

Loading…
Cancel
Save