diff options
author | Michael DeHaan <mdehaan@redhat.com> | 2008-06-25 14:58:20 -0400 |
---|---|---|
committer | Michael DeHaan <mdehaan@redhat.com> | 2008-06-25 14:58:20 -0400 |
commit | 1e7b1b8ba5a982ca801a4d8246934a2315dd5931 (patch) | |
tree | eb9138807fdb1b68143ac7bcf89828b2e8c3d003 /triggers | |
parent | 449e841102ab32c88c3559b92069ba648bd61a8d (diff) | |
download | third_party-cobbler-1e7b1b8ba5a982ca801a4d8246934a2315dd5931.tar.gz third_party-cobbler-1e7b1b8ba5a982ca801a4d8246934a2315dd5931.tar.xz third_party-cobbler-1e7b1b8ba5a982ca801a4d8246934a2315dd5931.zip |
Remove references to manage_dhcp_mode and manage_dns_mode as this is governed by modules.conf, and rewrite the restart-services trigger to understand restart_dhcp and restart_dns variables, which are now mentioned in the settings file. Also, clean up the tests so they work more nicely on F9, and remove some unused lines from the Makefile.
Diffstat (limited to 'triggers')
-rw-r--r-- | triggers/restart-services.trigger | 31 |
1 files changed, 21 insertions, 10 deletions
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) |