summaryrefslogtreecommitdiffstats
path: root/cobbler/config.py
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2006-05-05 17:48:01 -0400
committerJim Meyering <jim@meyering.net>2006-05-05 17:48:01 -0400
commit8e434ed6574a5b391d9b57f3cbb10f73e62a403c (patch)
tree0ccf20785615db6ae452a674959451a77af8eebc /cobbler/config.py
parent297525dcb3c500d086bb4a5006a5839d98f8522b (diff)
downloadthird_party-cobbler-8e434ed6574a5b391d9b57f3cbb10f73e62a403c.tar.gz
third_party-cobbler-8e434ed6574a5b391d9b57f3cbb10f73e62a403c.tar.xz
third_party-cobbler-8e434ed6574a5b391d9b57f3cbb10f73e62a403c.zip
Interim commit
Diffstat (limited to 'cobbler/config.py')
-rw-r--r--cobbler/config.py65
1 files changed, 65 insertions, 0 deletions
diff --git a/cobbler/config.py b/cobbler/config.py
new file mode 100644
index 0000000..27c33bd
--- /dev/null
+++ b/cobbler/config.py
@@ -0,0 +1,65 @@
+"""
+Config.py is a repository of the Cobbler object model
+"""
+import weakref
+
+import distro
+import profile
+import system
+
+import distros
+import profiles
+import systems
+
+import settings
+import serializer
+
+class Config:
+
+ def __init__(self):
+ # manage a definitive copy of all data collections with weakrefs
+ # back here so they can understand each other
+ self._distros = distros.Distros(weakref.proxy(self))
+ self._profiles = profiles.Profiles(weakref.proxy(self))
+ self._systems = systems.Systems(weakref.proxy(self))
+ self._settings = settings.Settings() # not a true collection
+ self._classes = [
+ self._distros,
+ self._profiles,
+ self._systems,
+ self._settings,
+ ]
+
+ def distros(self):
+ return self._distros
+
+ def profiles(self):
+ return self._profiles
+
+ def systems(self):
+ return self._systems
+
+ def settings(self):
+ return self._app_settings
+
+ def new_distro(self):
+ return distro.Distro(weakref.proxy(self))
+
+ def new_system(self):
+ return system.System(weakref.proxy(self))
+
+ def new_profile(self):
+ return profile.Profile(weakref.proxy(self))
+
+ def clear(self):
+ for x in self._classes:
+ x.clear()
+
+ def serialize(self):
+ for x in self._classes:
+ serializer.serialize(x)
+
+ def deserialize(self):
+ for x in self._classes:
+ serializer.deserialize(x)
+