From 2e61e8b202e883a899413bd8c18e9ad04709f031 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 5 Oct 2011 16:44:22 +0200 Subject: [PATCH] finish object class Signed-off-by: Steven Armstrong --- lib/cdist/object.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/cdist/object.py b/lib/cdist/object.py index 396d8e48..0a282dc2 100644 --- a/lib/cdist/object.py +++ b/lib/cdist/object.py @@ -26,8 +26,26 @@ log = logging.getLogger(__name__) class Object(object): - def __init__(self, path, remote_path): + + def __init__(self, path, remote_path, object_fq): self.path = path self.remote_path = remote_path + self.object_fq = object_fq + self.type = self.object_fq.split(os.sep)[0] + self.object_id = self.object_fq.split(os.sep)[1:] + self.parameter_dir = os.path.join(self.path, "parameter") + self.remote_object_parameter_dir = os.path.join(self.remote_path, "parameter") + self.object_code_paths = [ + os.path.join(self.path, "code-local"), + os.path.join(self.path, "code-remote")] + @property + def type_explorer_output_dir(self): + """Returns and creates dir of the output for a type explorer""" + if not self.__type_explorer_output_dir: + dir = os.path.join(self.path, "explorer") + if not os.path.isdir(dir): + os.mkdir(dir) + self.__type_explorer_output_dir = dir + return self.__type_explorer_output_dir