From 7d0238682b1f9eac6ad8ce3b4d0e636433f93eae Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 2 Nov 2011 23:58:18 +0100 Subject: [PATCH] implement autorequire in emulator Signed-off-by: Steven Armstrong --- lib/cdist/emulator.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py index 4880c6e6..5b842a91 100644 --- a/lib/cdist/emulator.py +++ b/lib/cdist/emulator.py @@ -75,6 +75,7 @@ class Emulator(object): self.commandline() self.setup_object() self.record_requirements() + self.record_auto_requirements() self.log.debug("Finished %s %s" % (self.cdist_object.path, self.parameters)) def __init_log(self): @@ -178,3 +179,12 @@ class Emulator(object): # Record / Append source self.cdist_object.source.append(self.object_source) + + def record_auto_requirements(self): + """An object shall automatically depend on all objects that it defined in it's type manifest. + """ + # __object_name is the name of the object whose type manifest is currenlty executed + __object_name = os.environ.get('__object_name', None) + if __object_name: + _object = self.cdist_object.object_from_name(__object_name) + _object.requirements.append(self.cdist_object.name)