diff options
author | Michael DeHaan <mdehaan@redhat.com> | 2006-05-05 18:30:44 -0400 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2006-05-05 18:30:44 -0400 |
commit | c1aea64f02ae55d47c18269895717af99839ed0e (patch) | |
tree | be13cc5c96d135cd8a08fd0794507650a55ad35b /cobbler/collection_distros.py | |
parent | 3e38df5996d007b4eedc65c4b357502f3e03b604 (diff) | |
download | third_party-cobbler-c1aea64f02ae55d47c18269895717af99839ed0e.tar.gz third_party-cobbler-c1aea64f02ae55d47c18269895717af99839ed0e.tar.xz third_party-cobbler-c1aea64f02ae55d47c18269895717af99839ed0e.zip |
Interim commit during refactoring. Pretty broken as a result of some cleanup but it will get straightened out very soon. The main thing I'm doing here is to remove backreferences from the object tree and make the API simpler, so that folks using the API screw up less. This means making the CLI code simpler as well. The serializer has also been overhauled so it's not as much bolted on, although I have some fixing to do to make it work entirely correctly. Wanted to check all of this in case someone decided to patch something else, making diffing really complex in the interim. I'd recommend not patching anything else to this code as I'm not close to done, really.
Diffstat (limited to 'cobbler/collection_distros.py')
-rw-r--r-- | cobbler/collection_distros.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/cobbler/collection_distros.py b/cobbler/collection_distros.py new file mode 100644 index 0000000..66472bf --- /dev/null +++ b/cobbler/collection_distros.py @@ -0,0 +1,33 @@ + +import utils +import collection +import item_distro as distro +import collection_profiles as profiles + +""" +A distro represents a network bootable matched set of kernels +and initrd files +""" +class Distros(collection.Collection): + + def factory_produce(self,config): + return distro.Distro(config) + + def filename(self): + return "/var/lib/cobbler/distros" + + def remove(self,name): + """ + Remove element named 'name' from the collection + """ + # first see if any Groups use this distro + for k,v in self.config.profiles().listing.items(): + if v.distro == name: + utils.set_error("orphan_files") + return False + if self.find(name): + del self.listing[name] + return True + utils.set_error("delete_nothing") + return False + |