summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2007-11-29 14:58:46 -0500
committerMichael DeHaan <mdehaan@redhat.com>2007-11-29 14:58:46 -0500
commit231ef515b22aa0204c625340f492eba651ef4bae (patch)
treef835e671d7c233e6c71ec7b1c1af58a6f76de7d7
parentbddd3d6affa106b800f9ad1ec25f0dcfed750604 (diff)
downloadthird_party-cobbler-231ef515b22aa0204c625340f492eba651ef4bae.zip
third_party-cobbler-231ef515b22aa0204c625340f492eba651ef4bae.tar.gz
third_party-cobbler-231ef515b22aa0204c625340f492eba651ef4bae.tar.xz
Initial application of Tim V's patch to enable post install triggers.
-rw-r--r--MANIFEST.in1
-rw-r--r--cobbler.spec2
-rw-r--r--cobbler/action_sync.py6
-rw-r--r--cobbler/remote.py21
-rw-r--r--cobbler/settings.py1
-rw-r--r--cobbler/webui/master.py10
-rw-r--r--config/settings1
-rwxr-xr-xscripts/findks.cgi2
-rw-r--r--setup.py3
9 files changed, 39 insertions, 8 deletions
diff --git a/MANIFEST.in b/MANIFEST.in
index 7375351..1a7c3e3 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -23,6 +23,7 @@ include scripts/cobblerd
include scripts/findks.cgi
include scripts/nopxe.cgi
include scripts/webui.cgi
+include scripts/postinstalltrigger.cgi
include snippets/*
recursive-include po *.pot
recursive-include po *.po
diff --git a/cobbler.spec b/cobbler.spec
index 7bf245c..b3bbd85 100644
--- a/cobbler.spec
+++ b/cobbler.spec
@@ -78,6 +78,7 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
%dir /var/www/cgi-bin/cobbler/
/var/www/cgi-bin/cobbler/findks.cgi
/var/www/cgi-bin/cobbler/nopxe.cgi
+/var/www/cgi-bin/cobbler/postinstalltrigger.cgi
/var/www/cgi-bin/cobbler/webui.cgi
%defattr(660,apache,apache)
%config(noreplace) /var/www/cgi-bin/cobbler/.htaccess
@@ -167,6 +168,7 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
%dir /var/lib/cobbler/triggers/delete/repo/post
%dir /var/lib/cobbler/triggers/sync/pre
%dir /var/lib/cobbler/triggers/sync/post
+%dir /var/lib/cobbler/triggers/install/post
%dir /var/lib/cobbler/snippets/
%defattr(744,root,root)
diff --git a/cobbler/action_sync.py b/cobbler/action_sync.py
index f81c2cd..c8ab81e 100644
--- a/cobbler/action_sync.py
+++ b/cobbler/action_sync.py
@@ -2,8 +2,9 @@
Builds out a TFTP/cobbler boot tree based on the object tree.
This is the code behind 'cobbler sync'.
-Copyright 2006, Red Hat, Inc
+Copyright 2006,2007, Red Hat, Inc
Michael DeHaan <mdehaan@redhat.com>
+Tim Verhoeven <tim.verhoeven.be@gmail.com>
This software may be freely redistributed under the terms of the GNU
general public license.
@@ -389,6 +390,7 @@ class BootSync:
pattern1 = "wget \"http://%s/cblr/watcher.py?%s_%s=%s\" -b"
pattern2 = "wget \"http://%s/cgi-bin/cobbler/nopxe.cgi?system=%s\" -b"
pattern3 = "wget \"http://%s/cobbler/%s/%s/ks.cfg\" -O /root/cobbler.ks"
+ pattern4 = "wget \"http://%s/cgi-bin/cobbler/postinstalltrigger.cgi?system=%s\" -b"
blend_this = profile
if system:
@@ -404,6 +406,8 @@ class BootSync:
buf = buf + "\n" + pattern2 % (blended["server"], system.name)
if kickstart and os.path.exists(kickstart):
buf = buf + "\n" + pattern3 % (blended["server"], "kickstarts_sys", system.name)
+ if self.settings.run_postinstall_trigger:
+ buf = buf + "\n" + pattern4 % (blended["server"], system.name)
else:
buf = buf + pattern1 % (blended["server"], "profile", "done", profile.name)
diff --git a/cobbler/remote.py b/cobbler/remote.py
index ff8d2db..5d3f91e 100644
--- a/cobbler/remote.py
+++ b/cobbler/remote.py
@@ -145,6 +145,27 @@ class CobblerXMLRPCInterface:
systems.add(obj,with_copy=True)
return True
+ def run_postinstalltrigger(self,name,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.
+ """
+ # used by postinstalltrigger.cgi
+ self.logger.debug("Starting run_postinstalltrigger")
+ self.api.clear()
+ self.api.deserialize()
+ if not self.api.settings().run_postinstall_trigger:
+ # feature disabled!
+ return False
+ systems = self.api.systems()
+ obj = systems.find(name=name)
+ if obj == None:
+ # system not found!
+ return False
+ utils.run_triggers(obj, "/var/lib/cobbler/triggers/install/post/*")
+ return True
+
def _refresh(self):
"""
Internal function to reload cobbler's configuration from disk. This is used to prevent any out
diff --git a/cobbler/settings.py b/cobbler/settings.py
index 8a3c7f7..43b3e06 100644
--- a/cobbler/settings.py
+++ b/cobbler/settings.py
@@ -43,6 +43,7 @@ DEFAULTS = {
"manage_dhcp_mode" : "isc",
"next_server" : "127.0.0.1",
"pxe_just_once" : 0,
+ "run_postinstall_trigger" : 0,
"server" : "127.0.0.1",
"snippetsdir" : "/var/lib/cobbler/snippets",
"syslog_port" : 25150,
diff --git a/cobbler/webui/master.py b/cobbler/webui/master.py
index 3eeb95e..89cf4a8 100644
--- a/cobbler/webui/master.py
+++ b/cobbler/webui/master.py
@@ -31,12 +31,12 @@ VFFSL=valueFromFrameOrSearchList
VFSL=valueFromSearchList
VFN=valueForName
currentTime=time.time
-__CHEETAH_version__ = '2.0'
-__CHEETAH_versionTuple__ = (2, 0, 0, 'final', 0)
-__CHEETAH_genTime__ = 1195069391.0795169
-__CHEETAH_genTimestamp__ = 'Wed Nov 14 14:43:11 2007'
+__CHEETAH_version__ = '2.0rc8'
+__CHEETAH_versionTuple__ = (2, 0, 0, 'candidate', 8)
+__CHEETAH_genTime__ = 1196349031.5462351
+__CHEETAH_genTimestamp__ = 'Thu Nov 29 16:10:31 2007'
__CHEETAH_src__ = 'webui_templates/master.tmpl'
-__CHEETAH_srcLastModified__ = 'Wed Nov 7 12:24:52 2007'
+__CHEETAH_srcLastModified__ = 'Thu Nov 29 14:40:41 2007'
__CHEETAH_docstring__ = 'Autogenerated by CHEETAH: The Python-Powered Template Engine'
if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
diff --git a/config/settings b/config/settings
index 85d6395..bc2949d 100644
--- a/config/settings
+++ b/config/settings
@@ -18,6 +18,7 @@ manage_dhcp: 0
manage_dhcp_mode: isc
next_server: '127.0.0.1'
pxe_just_once: 0
+run_postinstall_trigger: 0
server: '127.0.0.1'
snippetsdir: /var/lib/cobbler/snippets
syslog_port: 25150
diff --git a/scripts/findks.cgi b/scripts/findks.cgi
index fbb6fd2..70b9870 100755
--- a/scripts/findks.cgi
+++ b/scripts/findks.cgi
@@ -22,7 +22,7 @@ import socket
import xmlrpclib
COBBLER_BASE = "/var/www/cobbler"
-XMLRPC_SERVER = "http://127.0.0.1:25151"
+XMLRPC_SERVER = "http://127.0.0.1/cobbler_api_rw"
#----------------------------------------------------------------------
diff --git a/setup.py b/setup.py
index 04ba3ec..2a1acfc 100644
--- a/setup.py
+++ b/setup.py
@@ -63,7 +63,7 @@ if __name__ == "__main__":
# cgi files
(cgipath, ['scripts/findks.cgi', 'scripts/nopxe.cgi']),
- (cgipath, ['scripts/webui.cgi']),
+ (cgipath, ['scripts/webui.cgi', 'scripts/postinstalltrigger.cgi']),
# miscellaneous config files
(cgipath, ['config/.htaccess']),
@@ -192,6 +192,7 @@ if __name__ == "__main__":
("%sdelete/repo/pre" % trigpath, []),
("%sdelete/repo/post" % trigpath, []),
("%sdelete/repo/post" % trigpath, []),
+ ("%sinstall/post" % trigpath, []),
("%ssync/pre" % trigpath, []),
("%ssync/post" % trigpath, [ "triggers/restart-services.trigger" ])
],