summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cobbler/action_check.py13
-rw-r--r--cobbler/action_sync.py13
-rw-r--r--cobbler/cobbler_msg.py3
-rw-r--r--cobbler/item_system.py20
-rw-r--r--cobbler/settings.py6
-rw-r--r--dhcp.template51
6 files changed, 98 insertions, 8 deletions
diff --git a/cobbler/action_check.py b/cobbler/action_check.py
index d10c162..e0cfc12 100644
--- a/cobbler/action_check.py
+++ b/cobbler/action_check.py
@@ -71,8 +71,11 @@ class BootCheck:
"""
Check if pxelinux (part of syslinux) is installed
"""
- if not os.path.exists(self.settings.pxelinux):
- status.append(cobbler_msg.lookup("no_pxelinux"))
+ for pxelinux in keys(self.settings.pxelinuxes):
+ filename = self.settings.pxelinuxes[pxelinux]
+ if not os.path.exists(filename):
+ status.append(cobbler_msg.lookup("no_pxelinux"))
+ return
def check_tftpd_bin(self,status):
"""
@@ -111,11 +114,17 @@ class BootCheck:
def check_dhcpd_conf(self,status):
"""
+ NOTE: this code only applies if cobbler is *NOT* set to generate
+ a dhcp.conf file
+
Check that dhcpd *appears* to be configured for pxe booting.
We can't assure file correctness. Since a cobbler user might
have dhcp on another server, it's okay if it's not there and/or
not configured correctly according to automated scans.
"""
+ if not (self.settings.manage_dhcp == 0):
+ return
+
if os.path.exists(self.settings.dhcpd_conf):
match_next = False
match_file = False
diff --git a/cobbler/action_sync.py b/cobbler/action_sync.py
index 07d4f2d..e7eb004 100644
--- a/cobbler/action_sync.py
+++ b/cobbler/action_sync.py
@@ -64,10 +64,15 @@ class BootSync:
def copy_pxelinux(self):
"""
Copy syslinux to the configured tftpboot directory
-
- NOTE: relevant to tftp part only (should be obvious)
- """
- self.copy(self.settings.pxelinux, os.path.join(self.settings.tftpboot, "pxelinux.0"))
+ NOTE: we support different arch's if defined in
+ /var/lib/cobbler/settings.
+ """
+ for pxelinux in keys(self.settings.pxelinuxes):
+ path = self.settings.pxelinuxes[path]
+ self.copy(path, os.path.join(self.settings.tftpboot, pxelinux))
+ # for i386, save it as the canonical name also
+ if pxelinux == "pxelinux.i386":
+ self.copy(path, os.path.join(self.settings.tftpboot, "pxelinux.0");
def configure_httpd(self):
"""
diff --git a/cobbler/cobbler_msg.py b/cobbler/cobbler_msg.py
index 341fecf..aff5ba8 100644
--- a/cobbler/cobbler_msg.py
+++ b/cobbler/cobbler_msg.py
@@ -34,7 +34,7 @@ _msg_table = {
"need_perms" : "cobbler could not access %s",
"need_perms2" : "cobbler could not copy %s to %s",
"no_dhcpd" : "cobbler couldn't find dhcpd, try 'yum install dhcpd'",
- "no_pxelinux" : "cobbler couldn't find pxelinux, try 'yum install pxelinux'",
+ "no_pxelinux" : "missing 1 or more pxelinux files listed in /var/lib/cobbler/settings"
"no_tftpd" : "cobbler couldn't find tftpd, try 'yum install tftpd'",
"no_dir" : "cobbler couldn't find %s, please create it",
"chg_attrib" : "need to change field '%s' value to '%s' in file '%s'",
@@ -73,6 +73,7 @@ _msg_table = {
"exc_xen_para" : "invalid Xen paravirtualization setting",
"exc_profile" : "invalid profile name",
"exc_profile2" : "profile name not set",
+ "exc_pxe_arch" : "specified PXE file not found in /var/lib/cobbler/settings"
"check_ok" : """
No setup problems found.
diff --git a/cobbler/item_system.py b/cobbler/item_system.py
index deed184..ff6d447 100644
--- a/cobbler/item_system.py
+++ b/cobbler/item_system.py
@@ -27,12 +27,14 @@ class System(item.Item):
self.profile = None # a name, not a reference
self.kernel_options = ""
self.ks_meta = ""
+ self.pxe_arch = "i386"
def from_datastruct(self,seed_data):
self.name = seed_data['name']
self.profile = seed_data['profile']
self.kernel_options = seed_data['kernel_options']
self.ks_meta = seed_data['ks_meta']
+ self.ks_meta = seed_data["pxe_arch"]
return self
def set_name(self,name):
@@ -60,6 +62,22 @@ class System(item.Item):
return True
raise cexceptions.CobblerException("exc_profile")
+ def set_pxe_arch(self,new_arch):
+ """
+ The PXE architecture field is naturally relevant to PXE only.
+ Should someone have Itanium machines on a network, having
+ pxelinux.0 be the only option in the config file causes
+ problems. Using an alternative architecture here allows
+ for dhcpd.conf templating to "do the right thing" with
+ those systems. If manage_dhcp is off in /var/lib/cobbler/settings
+ this parameter is meaningless. It only has value when
+ generating a dhcp file.
+ """
+ for arch in keys(self.config.pxelinuxes):
+ if arch == new_arch:
+ return True
+ raise cexceptions.CobblerException("exc_pxe_arch")
+
def is_valid(self):
"""
A system is valid when it contains a valid name and a profile.
@@ -76,6 +94,7 @@ class System(item.Item):
'profile' : self.profile,
'kernel_options' : self.kernel_options,
'ks_meta' : self.ks_meta,
+ 'pxe_arch' : self.pxe_arch
}
def printable(self,id):
@@ -83,5 +102,6 @@ class System(item.Item):
buf = buf + "profile : %s\n" % self.profile
buf = buf + "kernel options : %s" % self.kernel_options
buf = buf + "ks metadata : %s" % self.ks_meta
+ buf = buf + "pxe arch : %s" % self.pxe_arch
return buf
diff --git a/cobbler/settings.py b/cobbler/settings.py
index 39d4393..304f748 100644
--- a/cobbler/settings.py
+++ b/cobbler/settings.py
@@ -35,7 +35,6 @@ class Settings(serializable.Serializable):
"""
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",
@@ -44,6 +43,11 @@ class Settings(serializable.Serializable):
"tftpd_conf" : "/etc/xinetd.d/tftp",
"tftpboot" : "/tftpboot",
"webdir" : "/var/www/cobbler",
+ "manage_dhcp" : 0,
+ "pxelinuxes" : {
+ "i386" : "/usr/lib/syslinux/pxelinux.0"
+ "ia64" : "/no/path/to/this/file/pxelinux.0"
+ }
}
def printable(self):
diff --git a/dhcp.template b/dhcp.template
new file mode 100644
index 0000000..700de4c
--- /dev/null
+++ b/dhcp.template
@@ -0,0 +1,51 @@
+# ******************************************************************
+# Cobbler managed dhcpd.conf file
+#
+# generated from cobbler dhcp.conf template ($date)
+#
+# Note to Admins:
+#
+# cobbler will only manage dhcpd.conf if manage_dhcp is set in
+# /var/lib/cobbler/settings and will only be updated
+# when cobbler sync is run. For configuring systems, see
+# "man cobbler"
+#
+# ******************************************************************
+
+# ** these values are probably sane for most environments
+ddns-update-style ad-hoc;
+set vendorclass = option vendor-class-identifier;
+
+# ** DO *NOT* change anything in this section or PXE will stop working
+# cobbler will magically deal with PXE architecture changes
+allow booting;
+allow bootp;
+filename "/pxelinux.i386";
+
+# ** this value must point to your cobbler server
+next-server 10.10.76.51;
+
+# ** it's ok to change this values if needed
+default-lease-time 7200;
+max-lease-time 86400;
+
+# ** these values must be changed for your network
+option domain-name "foo.example_corp.com bar.example_corp.com"
+option domain-name-servers 172.16.52.28, 172.16.52.27;
+option ntp-servers clock.example_corp.com;
+
+# ** these whole block should be tweaked for your network
+shared-network rhndev {
+ subnet 10.10.76.0 netmask 255.255.254.0 {
+ option routers 10.10.77.254;
+ option subnet-mask 255.255.254.0;
+ }
+}
+
+
+# ** leave this line intact
+$insert_cobbler_system_definitions
+
+# ** optional footer data here
+# ...
+