summaryrefslogtreecommitdiffstats
path: root/cobbler/serializer.py
diff options
context:
space:
mode:
authorroot <root@mdehaan.rdu.redhat.com>2007-09-05 18:15:33 -0400
committerroot <root@mdehaan.rdu.redhat.com>2007-09-05 18:15:33 -0400
commit321084391b0115dd2b68b03f367a8f859717d3c6 (patch)
tree894268f2a5f4841f647d64e74cde6bb205476069 /cobbler/serializer.py
parent674b523dd71d0bfe88cc600aa122f6a22e7b64a7 (diff)
downloadthird_party-cobbler-321084391b0115dd2b68b03f367a8f859717d3c6.tar.gz
third_party-cobbler-321084391b0115dd2b68b03f367a8f859717d3c6.tar.xz
third_party-cobbler-321084391b0115dd2b68b03f367a8f859717d3c6.zip
Further work on interchangeable backends. Rather than keeping the config file
format choice in settings (which is something of a Catch-22 situation), this may end up being a config file setting in /etc. Module loaders work and still default to yaml, though I've coded up a sample simple_json serializer that will be functional if users install simple-json. This is just demoware, JSON isn't replacing yaml and is (at least in this case) not as readable because of the way it escapes slashes. This is primarily to enable future work to integrate with other config file formats, such as possibly getting some of the system info from LDAP. Possibly.
Diffstat (limited to 'cobbler/serializer.py')
-rw-r--r--cobbler/serializer.py17
1 files changed, 4 insertions, 13 deletions
diff --git a/cobbler/serializer.py b/cobbler/serializer.py
index 15dcd10..bdfbb65 100644
--- a/cobbler/serializer.py
+++ b/cobbler/serializer.py
@@ -22,6 +22,7 @@ import yaml # Howell-Clark version
from cexceptions import *
import utils
import api as cobbler_api
+import modules.serializer_yaml as serializer_yaml
MODULE_CACHE = {}
@@ -40,19 +41,9 @@ def deserialize(obj,topological=False):
storage_module = __get_storage_module(obj.collection_type())
return storage_module.deserialize(obj,topological)
-
def __get_storage_module(collection_type):
- if MODULE_CACHE.has_key(collection_type):
- return MODULE_CACHE[collection_type]
- config = cobbler_api.BootAPI()._config
- settings = config.settings()
- storage_module_name = settings.storage_modules.get(collection_type, None)
- if not storage_module_name:
- raise CX(_("Storage module not set for objects of type %s") % collection_type)
- storage_module = config.modules.get(storage_module_name, None)
- if not storage_module:
- raise CX(_("Storage module %s not present") % storage_module_name)
- MODULE_CACHE[collection_type] = storage_module
- return storage_module
+ # FIXME: this is always fixed currently, and should not be.
+ return cobbler_api.BootAPI().modules["serializer_yaml"]
+