From 022b17d70067c933505925c3c5b5920ed664be6f Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 19 Oct 2011 14:53:31 +0200 Subject: [PATCH] implement Object state Signed-off-by: Steven Armstrong --- lib/cdist/core/object.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index 8cecfe6d..a35182d2 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -51,6 +51,11 @@ class Object(object): """ + # Constants for use with Object.state + STATE_PREPARED = "prepared" + STATE_RUNNING = "running" + STATE_DONE = "done" + @classmethod def list_objects(cls, object_base_path, type_base_path): """Return a list of object instances""" @@ -127,6 +132,7 @@ class Object(object): changed = fsproperty.FileBooleanProperty(lambda obj: os.path.join(obj.absolute_path, "changed")) prepared = fsproperty.FileBooleanProperty(lambda obj: os.path.join(obj.absolute_path, "prepared")) ran = fsproperty.FileBooleanProperty(lambda obj: os.path.join(obj.absolute_path, "ran")) + state = fsproperty.FileStringProperty(lambda obj: os.path.join(obj.absolute_path, "state")) source = fsproperty.FileListProperty(lambda obj: os.path.join(obj.absolute_path, "source")) code_local = fsproperty.FileStringProperty(lambda obj: os.path.join(obj.base_path, obj.code_local_path)) code_remote = fsproperty.FileStringProperty(lambda obj: os.path.join(obj.base_path, obj.code_remote_path))