diff options
-rw-r--r-- | CHANGELOG | 2 | ||||
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | cobbler/modules/manage_bind.py | 2 | ||||
-rw-r--r-- | cobbler/modules/manage_isc.py | 3 | ||||
-rw-r--r-- | cobbler/pxegen.py | 7 | ||||
-rw-r--r-- | cobbler/settings.py | 3 | ||||
-rw-r--r-- | config/settings | 13 | ||||
-rw-r--r-- | tests/tests.py | 11 | ||||
-rw-r--r-- | triggers/restart-services.trigger | 31 |
9 files changed, 55 insertions, 19 deletions
@@ -4,6 +4,8 @@ Cobbler CHANGELOG - Tue Jun 10 2008 - 1.0.3 (tentative) - Fix typo in replicate code - remove rhpl reference +- scrub references to manage_*_mode and rewrite the restart-services trigger +- add new settings to control whether the restart-trigger restarts things - Mon Jun 09 2008 - 1.0.2 - Fix mkdir invocation @@ -49,14 +49,12 @@ devinstall: -cp /tmp/cobbler_http.conf /etc/httpd/conf.d/cobbler.conf find /var/lib/cobbler/triggers | xargs chmod +x chown -R apache /var/www/cobbler - chown -R apache /var/www/cgi-bin/cobbler chmod -R +x /var/www/cobbler/web chmod -R +x /var/www/cobbler/svc webtest: devinstall /sbin/service cobblerd restart /sbin/service httpd restart - chmod +x /var/www/cgi-bin/cobbler/*.cgi sdist: clean messages updatewui python setup.py sdist diff --git a/cobbler/modules/manage_bind.py b/cobbler/modules/manage_bind.py index 339fbf0..d88c87c 100644 --- a/cobbler/modules/manage_bind.py +++ b/cobbler/modules/manage_bind.py @@ -49,7 +49,7 @@ def register(): class BindManager: def what(self): - return "isc_and_bind" + return "bind" def __init__(self,config,verbose=False): """ diff --git a/cobbler/modules/manage_isc.py b/cobbler/modules/manage_isc.py index c398270..5e4fbf6 100644 --- a/cobbler/modules/manage_isc.py +++ b/cobbler/modules/manage_isc.py @@ -48,7 +48,7 @@ def register(): class IscManager: def what(self): - return "isc_and_bind" + return "isc" def __init__(self,config,verbose=False): """ @@ -130,7 +130,6 @@ class IscManager: settings_file = self.settings.dhcpd_conf template_file = "/etc/cobbler/dhcp.template" - mode = self.settings.manage_dhcp_mode.lower() try: f2 = open(template_file,"r") diff --git a/cobbler/pxegen.py b/cobbler/pxegen.py index 94bdb2a..048e7ad 100644 --- a/cobbler/pxegen.py +++ b/cobbler/pxegen.py @@ -127,11 +127,14 @@ class PXEGen: f1 = utils.get_config_filename(system,interface=name) + if distro.arch is None or distro.arch == "": + distro.arch = "x86" + # for tftp only ... if distro.arch in [ "i386", "x86", "x86_64", "standard"]: # pxelinux wants a file named $name under pxelinux.cfg f2 = os.path.join(self.bootloc, "pxelinux.cfg", f1) - if distro.arch == "ia64": + elif distro.arch == "ia64": # elilo expects files to be named "$name.conf" in the root # and can not do files based on the MAC address if ip is not None and ip != "": @@ -139,6 +142,8 @@ class PXEGen: filename = "%s.conf" % utils.get_config_filename(system,interface=name) f2 = os.path.join(self.bootloc, filename) + else: + raise CX(_("Invalid arch %s, cobbler is confused") % distro.arch) f3 = os.path.join(self.settings.webdir, "systems", f1) diff --git a/cobbler/settings.py b/cobbler/settings.py index 4670ab0..bd5b0d3 100644 --- a/cobbler/settings.py +++ b/cobbler/settings.py @@ -58,7 +58,6 @@ DEFAULTS = { "ksdevice" : "eth0" }, "manage_dhcp" : 0, - "manage_dhcp_mode" : "isc", "manage_dns" : 0, "manage_forward_zones" : [], "manage_reverse_zones" : [], @@ -69,6 +68,8 @@ DEFAULTS = { "omshell_bin" : "/usr/bin/omshell", "pxe_just_once" : 0, "register_new_installs" : 0, + "restart_dns" : 1, + "restart_dhcp" : 1, "run_install_triggers" : 1, "server" : "127.0.0.1", "snippetsdir" : "/var/lib/cobbler/snippets", diff --git a/config/settings b/config/settings index 221241a..556a50d 100644 --- a/config/settings +++ b/config/settings @@ -110,6 +110,19 @@ omshell_bin: /usr/bin/omshell # for --netboot-enabled. pxe_just_once: 0 +# when DHCP and DNS management are enabled, cobbler sync can automatically +# restart those services to apply changes. The exception for this is +# if using ISC for DHCP, then omapi eliminates the need for a restart. +# If DHCP and DNS are going to be managed, but hosted on a box that +# is not on this server, disable restarts here and write some other +# script to ensure that the config files get copied/rsynced to the destination +# box. This can be done by modifying the restart services trigger. +# Note that if manage_dhcp and manage_dns are disabled, the respective +# parameter will have no effect. Most users should not need to change +# this. +restart_dns: 1 +restart_dhcp: 1 + # if set to 1, new systems doing profile based installations will # contact cobbler to have system records created for them containing # the mac address information that they have requested for install. diff --git a/tests/tests.py b/tests/tests.py index 02d53be..7c4c6bf 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -741,7 +741,11 @@ class SyncContents(BootTest): converted="01-bb-ee-ee-ee-ee-ff" - fh = open("/tftpboot/pxelinux.cfg/%s" % converted) + if os.path.exists("/var/lib/tftpboot"): + fh = open("/var/lib/tftpboot/pxelinux.cfg/%s" % converted) + else: + fh = open("/tftpboot/pxelinux.cfg/%s" % converted) + data = fh.read() self.assertTrue(data.find("/op/ks/") != -1) fh.close() @@ -751,7 +755,10 @@ class SyncContents(BootTest): # (which was an error we had in 0.6.3) self.api.sync() - fh = open("/tftpboot/pxelinux.cfg/%s" % converted) + if os.path.exists("/var/lib/tftpboot"): + fh = open("/var/lib/tftpboot/pxelinux.cfg/%s" % converted) + else: + fh = open("/tftpboot/pxelinux.cfg/%s" % converted) data = fh.read() self.assertTrue(data.find("/op/ks/") != -1) fh.close() diff --git a/triggers/restart-services.trigger b/triggers/restart-services.trigger index d586f46..6eac017 100644 --- a/triggers/restart-services.trigger +++ b/triggers/restart-services.trigger @@ -4,29 +4,40 @@ import cobbler.api as capi import os import sys -#!/usr/bin/python - bootapi = capi.BootAPI() settings = bootapi.settings() manage_dhcp = str(settings.manage_dhcp).lower() -manage_dhcp_mode = str(settings.manage_dhcp_mode).lower() manage_dns = str(settings.manage_dns).lower() +restart_dhcp = str(settings.restart_dhcp).lower() +restart_dns = str(settings.restart_dns).lower() omapi_enabled = settings.omapi_enabled omapi_port = settings.omapi_port +# load up our DHCP and DNS modules +bootapi.get_sync() +# bootapi.dhcp and bootapi.dns are now module references + +# special handling as we don't want to restart it twice +has_restarted_dnsmasq = False + rc = 0 if manage_dhcp != "0": - if manage_dhcp_mode == "isc": - if not omapi_enabled: + if bootapi.dhcp.what() == "isc": + if not omapi_enabled and restart_dhcp: rc = os.system("/sbin/service dhcpd restart") - elif manage_dhcp_mode == "dnsmasq": - rc = os.system("/sbin/service dnsmasq restart") + elif bootapi.dhcp.what() == "dnsmasq": + if restart_dhcp: + rc = os.system("/sbin/service dnsmasq restart") + has_restarted_dnsmasq = True else: - print "- error: unknown DHCP engine: %s" % manage_dhcp_mode + print "- error: unknown DHCP engine: %s" % bootapi.dhcp.what() rc = 411 -if manage_dns != "0": - rc = os.system("/sbin/service named restart") +if manage_dns != "0" and restart_dns: + if bootapi.dns.what() == "bind": + rc = os.system("/sbin/service named restart") + elif bootapi.dns.what() == "dnsmasq" and not has_restarted_dnsmasq: + rc = os.ssytem("/sbin/service dnsmasq restart") sys.exit(rc) |