finish migration to cdist_object.state

Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
Steven Armstrong 2011-10-19 15:48:22 +02:00
parent 6734ff693f
commit 8cfc16cd76

View file

@ -125,20 +125,21 @@ class ConfigInstall(object):
def object_run(self, cdist_object): def object_run(self, cdist_object):
"""Run gencode and code for an object""" """Run gencode and code for an object"""
self.log.info("" + cdist_object.name) self.log.info("Starting run of " + cdist_object.name)
if cdist_object.state == cdist.core.object.STATE_RUNNING: if cdist_object.state == core.Object.STATE_RUNNING:
raise cdist.Error("Detected circular dependency in " + cdist_object.__str__()) raise cdist.Error("Detected circular dependency in " + cdist_object.name)
elif cdist_object.state == cdist.core.object.STATE_DONE: elif cdist_object.state == core.Object.STATE_DONE:
self.log.debug("Ignoring run of already finished object %s", cdist_object)
return return
else: else:
cdist_object.state = cdist.core.object.STATE_RUNNING cdist_object.state = core.Object.STATE_RUNNING
cdist_type = cdist_object.type cdist_type = cdist_object.type
for requirement in cdist_object.requirements: for requirement in cdist_object.requirements:
self.log.debug("Object %s requires %s", cdist_object, requirement) self.log.debug("Object %s requires %s", cdist_object, requirement)
# FIXME: requirement is a string, need to create object here
required_object = cdist_object.object_from_name(requirement) required_object = cdist_object.object_from_name(requirement)
self.log.info("Resolving dependency %s for %s" % (required_object.name, cdist_object.name))
self.object_run(required_object) self.object_run(required_object)
self.log.info("Running gencode and code for " + cdist_object.name) self.log.info("Running gencode and code for " + cdist_object.name)
@ -156,6 +157,9 @@ class ConfigInstall(object):
self.code.transfer_code_remote(cdist_object) self.code.transfer_code_remote(cdist_object)
self.code.run_code_remote(cdist_object) self.code.run_code_remote(cdist_object)
# Mark this object as done
cdist_object.state == core.Object.STATE_DONE
def stage_run(self): def stage_run(self):
"""The final (and real) step of deployment""" """The final (and real) step of deployment"""
self.log.info("Generating and executing code") self.log.info("Generating and executing code")