summaryrefslogtreecommitdiffstats
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
parent84e318eef4e76e32a130b40b4d6939fa35d9a35e (diff)
downloadthird_party-cobbler-36c7abaa74b11786cd5f3184c17938b516baf890.zip
third_party-cobbler-36c7abaa74b11786cd5f3184c17938b516baf890.tar.gz
third_party-cobbler-36c7abaa74b11786cd5f3184c17938b516baf890.tar.xz
Allow for serialization modules to be selected by changing /etc/cobbler/modules.conf
-rw-r--r--CHANGELOG2
-rw-r--r--MANIFEST.in1
-rw-r--r--cobbler.spec1
-rw-r--r--cobbler/serializer.py14
-rw-r--r--config/modules.conf7
-rw-r--r--setup.py1
6 files changed, 24 insertions, 2 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 37fe14a..5dbe1d1 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -8,7 +8,7 @@ Cobbler CHANGELOG
- allow multiple (comma-seperated) values for --virt-size
- removed deprecated 'enchant' function (use SSH and koan instead)
- cleanup of a few unused settings
-- backend work to allow for multiple config file formats/loaders/serializers
+- allow for serialization modules to be selected in /etc/cobbler/modules.conf
* Thu Aug 30 2007 - 0.6.1
- re enable --resolve in yumdownloader (cobbler repo mgmt feature)
diff --git a/MANIFEST.in b/MANIFEST.in
index ce9dd12..c549f91 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -6,6 +6,7 @@ include config/rsync.exclude
include config/cobblerd
include config/cobblerd_rotate
include config/cobbler_hosts
+include config/modules.conf
recursive-include templates *.template
recursive-include kickstarts *.ks
include docs/cobbler.1.gz
diff --git a/cobbler.spec b/cobbler.spec
index 3e0a81f..822e702 100644
--- a/cobbler.spec
+++ b/cobbler.spec
@@ -104,6 +104,7 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
%config(noreplace) /etc/cobbler/pxesystem_ia64.template
%config(noreplace) /etc/cobbler/rsync.exclude
%config(noreplace) /etc/logrotate.d/cobblerd_rotate
+%config(noreplace) /etc/cobbler/modules.conf
%dir %{python_sitelib}/cobbler
%dir %{python_sitelib}/cobbler/yaml
%dir %{python_sitelib}/cobbler/modules
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
diff --git a/config/modules.conf b/config/modules.conf
new file mode 100644
index 0000000..fbe710c
--- /dev/null
+++ b/config/modules.conf
@@ -0,0 +1,7 @@
+[serializers]
+settings = serializer_yaml
+distro = serializer_yaml
+profile = serializer_yaml
+system = serializer_yaml
+repo = serializer_yaml
+
diff --git a/setup.py b/setup.py
index 6e9a89b..e095d93 100644
--- a/setup.py
+++ b/setup.py
@@ -67,6 +67,7 @@ if __name__ == "__main__":
(etcpath, ['templates/pxesystem.template']),
(etcpath, ['templates/pxesystem_ia64.template']),
(etcpath, ['templates/pxeprofile.template']),
+ (etcpath, ['config/modules.conf']),
(snippets, ['snippets/partition_select']),
(manpath, ['docs/cobbler.1.gz']),
(etcpath, ['config/rsync.exclude']),