From 1810462989c6ad6e81137ad2168907a14effe364 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 7 Oct 2011 09:05:42 +0200 Subject: [PATCH] move stuff over from path to object to be fixed Signed-off-by: Nico Schottelius --- lib/cdist/core/object.py | 36 +++++++++++++++++++++++++++++++++++- lib/cdist/path.py | 31 ------------------------------- 2 files changed, 35 insertions(+), 32 deletions(-) diff --git a/lib/cdist/core/object.py b/lib/cdist/core/object.py index dbb6542d..e75c06c8 100644 --- a/lib/cdist/core/object.py +++ b/lib/cdist/core/object.py @@ -161,4 +161,38 @@ class Object(object): pass ### /changed - # FIXME: implement other properties/methods + # FIXME: implement other properties/methods + + # FIXME: check following methods: implement or revoke / delete + # FIXME: Object + def get_object_id_from_object(self, cdist_object): + """Returns everything but the first part (i.e. object_id) of an object""" + return os.sep.join(cdist_object.split(os.sep)[1:]) + + # FIXME: Object + def object_dir(self, cdist_object): + """Returns the full path to the object (including .cdist)""" + return os.path.join(self.object_base_dir, cdist_object, DOT_CDIST) + + # FIXME: Object + def remote_object_dir(self, cdist_object): + """Returns the remote full path to the object (including .cdist)""" + return os.path.join(REMOTE_OBJECT_DIR, cdist_object, DOT_CDIST) + + # FIXME: Object + def object_parameter_dir(self, cdist_object): + """Returns the dir to the object parameter""" + return os.path.join(self.object_dir(cdist_object), "parameter") + + # FIXME: object + def remote_object_parameter_dir(self, cdist_object): + """Returns the remote dir to the object parameter""" + return os.path.join(self.remote_object_dir(cdist_object), "parameter") + + # FIXME: object + def object_code_paths(self, cdist_object): + """Return paths to code scripts of object""" + return [os.path.join(self.object_dir(cdist_object), "code-local"), + os.path.join(self.object_dir(cdist_object), "code-remote")] + + diff --git a/lib/cdist/path.py b/lib/cdist/path.py index e2d319ef..99adfe99 100644 --- a/lib/cdist/path.py +++ b/lib/cdist/path.py @@ -192,37 +192,6 @@ class Path: return object_paths - # FIXME: Object - def get_object_id_from_object(self, cdist_object): - """Returns everything but the first part (i.e. object_id) of an object""" - return os.sep.join(cdist_object.split(os.sep)[1:]) - - # FIXME: Object - def object_dir(self, cdist_object): - """Returns the full path to the object (including .cdist)""" - return os.path.join(self.object_base_dir, cdist_object, DOT_CDIST) - - # FIXME: Object - def remote_object_dir(self, cdist_object): - """Returns the remote full path to the object (including .cdist)""" - return os.path.join(REMOTE_OBJECT_DIR, cdist_object, DOT_CDIST) - - # FIXME: Object - def object_parameter_dir(self, cdist_object): - """Returns the dir to the object parameter""" - return os.path.join(self.object_dir(cdist_object), "parameter") - - # FIXME: object - def remote_object_parameter_dir(self, cdist_object): - """Returns the remote dir to the object parameter""" - return os.path.join(self.remote_object_dir(cdist_object), "parameter") - - # FIXME: object - def object_code_paths(self, cdist_object): - """Return paths to code scripts of object""" - return [os.path.join(self.object_dir(cdist_object), "code-local"), - os.path.join(self.object_dir(cdist_object), "code-remote")] - # Stays here def list_objects(self): """Return list of existing objects"""