summaryrefslogtreecommitdiffstats
path: root/cobbler/collection_profiles.py
blob: b1c92dd05780bece16b1b501eaf7492b76fb3956 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"""
A profile represents a distro paired with a kickstart file.
For instance, FC5 with a kickstart file specifying OpenOffice
might represent a 'desktop' profile.  For Xen, there are many
additional options, with client-side defaults (not kept here).

Michael DeHaan <mdehaan@redhat.com>
"""

import item_profile as profile
import utils
import collection
from cobbler_exception import CobblerException

#--------------------------------------------

class Profiles(collection.Collection):

    def factory_produce(self,config,seed_data):
        return profile.Profile(config).from_datastruct(seed_data)

    def filename(self):
        return "/var/lib/cobbler/profiles"

    def remove(self,name):
        """
        Remove element named 'name' from the collection
        """
        for k,v in self.config.systems().listing.items():
           if v.profile == name:
               raise CobblerException("orphan_system")
        if self.find(name):
            del self.listing[name]
            return True
        raise CobblerException("delete_nothing")