diff options
author | Michael DeHaan <mdehaan@mdehaan.rdu.redhat.com> | 2007-09-06 11:38:10 -0400 |
---|---|---|
committer | Michael DeHaan <mdehaan@mdehaan.rdu.redhat.com> | 2007-09-06 11:38:10 -0400 |
commit | 36c7abaa74b11786cd5f3184c17938b516baf890 (patch) | |
tree | c1fb8d5e751956c06e2ad0291b9efba0af88cd47 /cobbler/serializer.py | |
parent | 84e318eef4e76e32a130b40b4d6939fa35d9a35e (diff) | |
download | third_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.py | 14 |
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 |