From 36c7abaa74b11786cd5f3184c17938b516baf890 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Thu, 6 Sep 2007 11:38:10 -0400 Subject: Allow for serialization modules to be selected by changing /etc/cobbler/modules.conf --- cobbler/serializer.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'cobbler/serializer.py') diff --git a/cobbler/serializer.py b/cobbler/serializer.py index bdfbb65..35ff2d9 100644 --- a/cobbler/serializer.py +++ b/cobbler/serializer.py @@ -23,8 +23,11 @@ from cexceptions import * import utils import api as cobbler_api import modules.serializer_yaml as serializer_yaml +import ConfigParser MODULE_CACHE = {} +cp = ConfigParser.ConfigParser() +cp.read("/etc/cobbler/modules.conf") def serialize(obj): """ @@ -43,7 +46,16 @@ def deserialize(obj,topological=False): def __get_storage_module(collection_type): + + if not MODULE_CACHE.has_key(collection_type): + value = cp.get("serializers",collection_type) + module = cobbler_api.BootAPI().modules[value] + MODULE_CACHE[collection_type] = module + return module + else: + return MODULE_CACHE[collection_type] + # FIXME: this is always fixed currently, and should not be. - return cobbler_api.BootAPI().modules["serializer_yaml"] + return -- cgit