diff options
author | Michael DeHaan <mdehaan@redhat.com> | 2007-10-19 16:44:06 -0400 |
---|---|---|
committer | Michael DeHaan <mdehaan@redhat.com> | 2007-10-19 16:44:06 -0400 |
commit | 1b1222ec7f95a773fcab39bf1ebe68da198919be (patch) | |
tree | b180dc9a976886f143d0743cd725d3ec5bd3c707 /triggers | |
parent | d09c20fc07efb87cffcbac467f189e312eb67e9e (diff) | |
download | third_party-cobbler-1b1222ec7f95a773fcab39bf1ebe68da198919be.tar.gz third_party-cobbler-1b1222ec7f95a773fcab39bf1ebe68da198919be.tar.xz third_party-cobbler-1b1222ec7f95a773fcab39bf1ebe68da198919be.zip |
Service restarting has been abstracted out of the action_sync code, and is now a trigger.
This commit adds pre/post sync triggers, for scripting of arbitrary actions. The idea is that
a cobbler user can now modify the restart-services script to rsync DHCP configurations to a remote
box and instead restart them there, for hosting DHCP on a different box. Or do anything
else that might be required. The restart-services trigger will ship in the cobbler RPM. Users
can modify it at will and it is marked as config(noreplace) so upgrades will not affect it.
Diffstat (limited to 'triggers')
-rw-r--r-- | triggers/restart-services.trigger | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/triggers/restart-services.trigger b/triggers/restart-services.trigger new file mode 100644 index 0000000..98d478b --- /dev/null +++ b/triggers/restart-services.trigger @@ -0,0 +1,21 @@ +#!/usr/bin/python + +import cobbler.api as capi +import os +import sys + +bootapi = capi.BootAPI() +settings = bootapi.settings() +manage_dhcp = str(settings.manage_dhcp).lower() +manage_dhcp_mode = str(settings.manage_dhcp_mode).lower() + +if manage_dhcp != "0": + if manage_dhcp_mode == "isc": + rc = os.system("/sbin/service dhcpd restart") + elif manage_dhcp_mode == "dnsmasq": + rc = os.system("/sbin/service dnsmasq restart") + else: + print "- error: unknown DHCP engine: %s" % manage_dhcp_mode + rc = 411 + +sys.exit(rc) |