From 57f449cc30b59970b97d7ee4d74cc02a98e07e30 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Mon, 12 Nov 2007 13:25:23 -0500 Subject: Abstract out the modules system to allow for other types of modules, and to also centralize configuration/loading/access some more. --- cobbler/api.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'cobbler/api.py') diff --git a/cobbler/api.py b/cobbler/api.py index 2a51c1a..b846c81 100644 --- a/cobbler/api.py +++ b/cobbler/api.py @@ -38,7 +38,7 @@ class BootAPI: self.__dict__ = self.__shared_state if not BootAPI.has_loaded: BootAPI.has_loaded = True - self.modules = module_loader.load_modules() + module_loader.load_modules() self._config = config.Config(self) self.deserialize() @@ -232,6 +232,20 @@ class BootAPI: """ return self._config.deserialize_raw(collection_name) + def get_module_by_name(self,module_name): + """ + Returns a loaded cobbler module named 'name', if one exists, else None. + """ + return module_loader.get_module_by_name(module_name) + + def get_module_from_file(self,section,name): + """ + Looks in /etc/cobbler/modules.conf for a section called 'section' + and a key called 'name', and then returns the module that corresponds + to the value of that key. + """ + return module_loader.get_module_from_file(section,name) + if __name__ == "__main__": api = BootAPI() print api.version() -- cgit