summaryrefslogtreecommitdiffstats
path: root/cobbler/remote.py
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 /cobbler/remote.py
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 'cobbler/remote.py')
-rw-r--r--cobbler/remote.py32
1 files changed, 17 insertions, 15 deletions
diff --git a/cobbler/remote.py b/cobbler/remote.py
index f7e2226..b606bbc 100644
--- a/cobbler/remote.py
+++ b/cobbler/remote.py
@@ -230,26 +230,28 @@ class CobblerXMLRPCInterface:
systems.add(obj,save=True,with_triggers=False,with_sync=False,quick_pxe_update=True)
return True
- def run_post_install_triggers(self,name,token=None):
+ def run_install_triggers(self,mode,objtype,name,mac,ip,token=None):
+
"""
- This is a feature used to run the post install trigger.
- It passes the system named "name" to the trigger. Disabled by default as
- this requires public API access and is technically a read-write operation.
+ This is a feature used to run the pre/post install triggers.
+ See CobblerTriggers on Wiki for details
"""
- self.log("run_post_install_triggers",token=token)
- # used by postinstalltrigger.cgi
- self.api.clear()
- self.api.deserialize()
- if not self.api.settings().run_post_install_trigger:
- # feature disabled!
+ self.log("run_install_triggers",token=token)
+
+ if mode != "pre" and mode != "post":
return False
- systems = self.api.systems()
- obj = systems.find(name=name)
- if obj == None:
- # system not found!
+ if objtype != "system" and objtype !="profile":
return False
- utils.run_triggers(obj, "/var/lib/cobbler/triggers/install/post/*")
+
+ # the trigger script is called with name,mac, and ip as arguments 1,2, and 3
+ # we do not do API lookups here because they are rather expensive at install
+ # time if reinstalling all of a cluster all at once.
+ # we can do that at "cobbler check" time.
+
+ utils.run_triggers(None, "/var/lib/cobbler/triggers/install/%s/*" % mode, additional=[objtype,name,mac,ip])
+
+
return True
def _refresh(self):