summaryrefslogtreecommitdiffstats
path: root/cobbler/serializer.py
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@mdehaan.rdu.redhat.com>2007-09-06 11:38:10 -0400
committerMichael DeHaan <mdehaan@mdehaan.rdu.redhat.com>2007-09-06 11:38:10 -0400
commit36c7abaa74b11786cd5f3184c17938b516baf890 (patch)
treec1fb8d5e751956c06e2ad0291b9efba0af88cd47 /cobbler/serializer.py
parent84e318eef4e76e32a130b40b4d6939fa35d9a35e (diff)
downloadthird_party-cobbler-36c7abaa74b11786cd5f3184c17938b516baf890.tar.gz
third_party-cobbler-36c7abaa74b11786cd5f3184c17938b516baf890.tar.xz
third_party-cobbler-36c7abaa74b11786cd5f3184c17938b516baf890.zip
Allow for serialization modules to be selected by changing /etc/cobbler/modules.conf
Diffstat (limited to 'cobbler/serializer.py')
-rw-r--r--cobbler/serializer.py14
1 files changed, 13 insertions, 1 deletions
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