summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2007-11-29 17:05:04 -0500
committerMichael DeHaan <mdehaan@redhat.com>2007-11-29 17:05:04 -0500
commit4547a2759ce5369774676f16365492f14aad2392 (patch)
tree85ffd823e2b877ee6b4351f4081dd520d80a1756
parent231ef515b22aa0204c625340f492eba651ef4bae (diff)
downloadthird_party-cobbler-4547a2759ce5369774676f16365492f14aad2392.tar.gz
third_party-cobbler-4547a2759ce5369774676f16365492f14aad2392.tar.xz
third_party-cobbler-4547a2759ce5369774676f16365492f14aad2392.zip
Slight changes to post install triggers patch, namely adding some underscores.
-rw-r--r--MANIFEST.in2
-rw-r--r--cobbler.spec5
-rw-r--r--cobbler/action_sync.py4
-rw-r--r--cobbler/remote.py5
-rw-r--r--cobbler/settings.py2
-rw-r--r--cobbler/webui/master.py10
-rw-r--r--config/settings2
-rwxr-xr-xscripts/nopxe.cgi2
-rw-r--r--scripts/post_install_trigger.cgi72
-rw-r--r--setup.py2
10 files changed, 87 insertions, 19 deletions
diff --git a/MANIFEST.in b/MANIFEST.in
index 1a7c3e3..6af01ca 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -23,7 +23,7 @@ include scripts/cobblerd
include scripts/findks.cgi
include scripts/nopxe.cgi
include scripts/webui.cgi
-include scripts/postinstalltrigger.cgi
+include scripts/post_install_trigger.cgi
include snippets/*
recursive-include po *.pot
recursive-include po *.po
diff --git a/cobbler.spec b/cobbler.spec
index b3bbd85..1660c36 100644
--- a/cobbler.spec
+++ b/cobbler.spec
@@ -76,10 +76,7 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
%defattr(755,apache,apache)
%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
+/var/www/cgi-bin/cobbler/*.cgi
%defattr(660,apache,apache)
%config(noreplace) /var/www/cgi-bin/cobbler/.htaccess
%config(noreplace) /var/www/cgi-bin/cobbler/.htpasswd
diff --git a/cobbler/action_sync.py b/cobbler/action_sync.py
index c8ab81e..e1d61d8 100644
--- a/cobbler/action_sync.py
+++ b/cobbler/action_sync.py
@@ -390,7 +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"
+ pattern4 = "wget \"http://%s/cgi-bin/cobbler/post_install_trigger.cgi?system=%s\" -b"
blend_this = profile
if system:
@@ -406,7 +406,7 @@ 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:
+ if self.settings.run_post_install_trigger:
buf = buf + "\n" + pattern4 % (blended["server"], system.name)
else:
diff --git a/cobbler/remote.py b/cobbler/remote.py
index 5d3f91e..b6e6a04 100644
--- a/cobbler/remote.py
+++ b/cobbler/remote.py
@@ -145,17 +145,16 @@ class CobblerXMLRPCInterface:
systems.add(obj,with_copy=True)
return True
- def run_postinstalltrigger(self,name,token=None):
+ def run_post_install_triggers(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:
+ if not self.api.settings().run_post_install_trigger:
# feature disabled!
return False
systems = self.api.systems()
diff --git a/cobbler/settings.py b/cobbler/settings.py
index 43b3e06..8f9527d 100644
--- a/cobbler/settings.py
+++ b/cobbler/settings.py
@@ -43,7 +43,7 @@ DEFAULTS = {
"manage_dhcp_mode" : "isc",
"next_server" : "127.0.0.1",
"pxe_just_once" : 0,
- "run_postinstall_trigger" : 0,
+ "run_post_install_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 89cf4a8..5d630c6 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.0rc8'
-__CHEETAH_versionTuple__ = (2, 0, 0, 'candidate', 8)
-__CHEETAH_genTime__ = 1196349031.5462351
-__CHEETAH_genTimestamp__ = 'Thu Nov 29 16:10:31 2007'
+__CHEETAH_version__ = '2.0'
+__CHEETAH_versionTuple__ = (2, 0, 0, 'final', 0)
+__CHEETAH_genTime__ = 1196370730.2521651
+__CHEETAH_genTimestamp__ = 'Thu Nov 29 16:12:10 2007'
__CHEETAH_src__ = 'webui_templates/master.tmpl'
-__CHEETAH_srcLastModified__ = 'Thu Nov 29 14:40:41 2007'
+__CHEETAH_srcLastModified__ = 'Wed Nov 7 12:24:52 2007'
__CHEETAH_docstring__ = 'Autogenerated by CHEETAH: The Python-Powered Template Engine'
if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
diff --git a/config/settings b/config/settings
index bc2949d..d47635a 100644
--- a/config/settings
+++ b/config/settings
@@ -18,7 +18,7 @@ manage_dhcp: 0
manage_dhcp_mode: isc
next_server: '127.0.0.1'
pxe_just_once: 0
-run_postinstall_trigger: 0
+run_post_install_trigger: 0
server: '127.0.0.1'
snippetsdir: /var/lib/cobbler/snippets
syslog_port: 25150
diff --git a/scripts/nopxe.cgi b/scripts/nopxe.cgi
index e90e886..a2eae88 100755
--- a/scripts/nopxe.cgi
+++ b/scripts/nopxe.cgi
@@ -27,7 +27,7 @@ import xmlrpclib
from cobbler import sub_process as sub_process
COBBLER_BASE = "/var/www/cobbler"
-XMLRPC_SERVER = "http://127.0.0.1:25151"
+XMLRPC_SERVER = "http://127.0.0.1/cobbler_api"
#----------------------------------------------------------------------
diff --git a/scripts/post_install_trigger.cgi b/scripts/post_install_trigger.cgi
new file mode 100644
index 0000000..4a79c8b
--- /dev/null
+++ b/scripts/post_install_trigger.cgi
@@ -0,0 +1,72 @@
+#!/usr/bin/env python
+
+# This software may be freely redistributed under the terms of the GNU
+# general public license.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+# This script runs post install triggers in /var/lib/cobbler/triggers/install/post
+# if the triggers are enabled in the settings file.
+#
+# (C) Tim Verhoeven <tim.verhoeven.be@gmail.com>, 2007
+# tweaked: Michael DeHaan <mdehaan@redhat.com>
+
+import cgi
+import cgitb
+import time
+import os
+import sys
+import socket
+import xmlrpclib
+from cobbler import sub_process as sub_process
+
+COBBLER_BASE = "/var/www/cobbler"
+XMLRPC_SERVER = "http://127.0.0.1/cobbler_api"
+
+#----------------------------------------------------------------------
+
+class ServerProxy(xmlrpclib.ServerProxy):
+
+ def __init__(self, url=None):
+ xmlrpclib.ServerProxy.__init__(self, url, allow_none=True)
+
+#----------------------------------------------------------------------
+
+def parse_query():
+ """
+ Read arguments from query string.
+ """
+
+ form = cgi.parse()
+
+ if form.has_key("system"):
+ return form["system"][0]
+ return 0
+
+def invoke(name):
+ """
+ Determine if this feature is enabled.
+ """
+
+ xmlrpc_server = ServerProxy(XMLRPC_SERVER)
+ print xmlrpc_server.run_post_install_triggers(name)
+
+ return True
+
+#----------------------------------------------------------------------
+
+def header():
+ print "Content-type: text/plain"
+ print
+
+#----------------------------------------------------------------------
+
+if __name__ == "__main__":
+ cgitb.enable(format='text')
+ header()
+ name = parse_query()
+ invoke(name)
+
+
diff --git a/setup.py b/setup.py
index 2a1acfc..05bc079 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', 'scripts/postinstalltrigger.cgi']),
+ (cgipath, ['scripts/webui.cgi', 'scripts/post_install_trigger.cgi']),
# miscellaneous config files
(cgipath, ['config/.htaccess']),