diff options
author | Michael DeHaan <mdehaan@redhat.com> | 2006-05-05 17:48:01 -0400 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2006-05-05 17:48:01 -0400 |
commit | 8e434ed6574a5b391d9b57f3cbb10f73e62a403c (patch) | |
tree | 0ccf20785615db6ae452a674959451a77af8eebc /cobbler/config.py | |
parent | 297525dcb3c500d086bb4a5006a5839d98f8522b (diff) | |
download | third_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.py | 65 |
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) + |