summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2008-04-15 17:34:50 -0400
committerMichael DeHaan <mdehaan@redhat.com>2008-04-15 17:34:50 -0400
commit2ccbb4b130afac3d1707433b3988259ea109db7f (patch)
tree40b7a789997832f510acc7bed20a851f26f1cdbb /scripts
parent51119d1acc532cfad68b9fe4a1daa945fe7cd3f0 (diff)
downloadthird_party-cobbler-2ccbb4b130afac3d1707433b3988259ea109db7f.tar.gz
third_party-cobbler-2ccbb4b130afac3d1707433b3988259ea109db7f.tar.xz
third_party-cobbler-2ccbb4b130afac3d1707433b3988259ea109db7f.zip
Replaced the existing cobbler pre/post install triggers system with a much more flexible model that (for each system) passes in the following. First arg: the word "system" or "profile", Second arg: the name of the said system or profile, Third: the MAC if available, Fourth: the IP. This is all logged by a default "status" trigger to /var/log/cobbler/install.log, for being read by the soon-to-be-revamped cobbler check. The check system logs all of this in order, followed by the word "start" or "stop", followed by the number of seconds since Epoch.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/install_trigger.cgi (renamed from scripts/post_install_trigger.cgi)34
1 files changed, 27 insertions, 7 deletions
diff --git a/scripts/post_install_trigger.cgi b/scripts/install_trigger.cgi
index 4a79c8b..493591f 100644
--- a/scripts/post_install_trigger.cgi
+++ b/scripts/install_trigger.cgi
@@ -11,7 +11,7 @@
# if the triggers are enabled in the settings file.
#
# (C) Tim Verhoeven <tim.verhoeven.be@gmail.com>, 2007
-# tweaked: Michael DeHaan <mdehaan@redhat.com>
+# tweaked: Michael DeHaan <mdehaan@redhat.com>, 2007-2008
import cgi
import cgitb
@@ -41,17 +41,37 @@ def parse_query():
form = cgi.parse()
+ mac = "?"
+ if os.environ.has_key("HTTP_X_RHN_PROVISIONING_MAC_0"):
+ devicepair = os.environ["HTTP_X_RHN_PROVISIONING_MAC_0"]
+ mac = devicepair.split()[1].strip()
+
+ ip = "?"
+ if os.environ.has_key("REMOTE_ADDR"):
+ ip = os.environ["REMOTE_ADDR"]
+
+ name = "?"
+ objtype = "?"
if form.has_key("system"):
- return form["system"][0]
- return 0
+ name = form["system"][0]
+ objtype = "system"
+ elif form.has_key("profile"):
+ name = form["profile"][0]
+ objtype = "profile"
+
+ mode = "?"
+ if form.has_key("mode"):
+ mode = form["mode"][0]
+
+ return (mode,objtype,name,mac,ip)
-def invoke(name):
+def invoke(mode,objtype,name,mac,ip):
"""
Determine if this feature is enabled.
"""
xmlrpc_server = ServerProxy(XMLRPC_SERVER)
- print xmlrpc_server.run_post_install_triggers(name)
+ print xmlrpc_server.run_install_triggers(mode,objtype,name,mac,ip)
return True
@@ -66,7 +86,7 @@ def header():
if __name__ == "__main__":
cgitb.enable(format='text')
header()
- name = parse_query()
- invoke(name)
+ (mode,objtype,name,mac,ip) = parse_query()
+ invoke(mode,objtype,name,mac,ip)