blob: e740e13be1a272f41a3236a90d1007288cdef3ae (
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
"""
Cobbler app-wide settings
Michael DeHaan <mdehaan@redhat.com>
"""
import serializable
import utils
class Settings(serializable.Serializable):
def filename(self):
"""
The filename where settings are serialized.
"""
return "/var/lib/cobbler/settings"
def __init__(self):
"""
Constructor.
"""
self.clear()
def clear(self):
"""
Reset this object to reasonable default values.
"""
self._attributes = {
"httpd_bin" : "/usr/sbin/httpd",
"pxelinux" : "/usr/lib/syslinux/pxelinux.0",
"dhcpd_conf" : "/etc/dhcpd.conf",
"tftpd_bin" : "/usr/sbin/in.tftpd",
"server" : "localhost",
"dhcpd_bin" : "/usr/sbin/dhcpd",
"kernel_options" : "append devfs=nomount ramdisk_size=16438 lang= vga=788 ksdevice=eth0",
"tftpd_conf" : "/etc/xinetd.d/tftp",
"tftpboot" : "/tftpboot",
}
def to_datastruct(self):
"""
Return an easily serializable representation of the config.
"""
return self._attributes
def from_datastruct(self,datastruct):
"""
Modify this object to load values in datastruct.
"""
if datastruct is None:
print "warning: not loading empty structure for %s" % self.filename()
return
self._attributes = datastruct
return self
def __getattr__(self,name):
if self._attributes.has_key(name):
return self._attributes[name]
else:
raise AttributeError, name
|