diff options
| author | Michael DeHaan <mdehaan@redhat.com> | 2008-02-15 14:54:25 -0500 |
|---|---|---|
| committer | Michael DeHaan <mdehaan@redhat.com> | 2008-02-15 14:54:25 -0500 |
| commit | a47ee22ab684eed992128b60b136fca90ff9f119 (patch) | |
| tree | cd55daf8057049368b4aaa6d23c30408eae411d2 /scripts/post_install_trigger.cgi | |
| parent | 70bfc8f5a3150d09cc064a4c46efcaff80b29904 (diff) | |
| parent | a7d67f35019af0c25f133c979112fc6035d7e04c (diff) | |
Merge branch 'devel'
Merging devel work on 0.7.X/0.8 release with master
Conflicts:
CHANGELOG
cobbler.spec
cobbler/action_import.py
cobbler/utils.py
cobbler/webui/master.py
setup.py
Diffstat (limited to 'scripts/post_install_trigger.cgi')
| -rw-r--r-- | scripts/post_install_trigger.cgi | 72 |
1 files changed, 72 insertions, 0 deletions
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) + + |
