Commit e7de55e2 authored by Rafael Monnerat's avatar Rafael Monnerat

stack/monitor: Remove unused files.

parent ba721017
#!{{ python_executable }}
print("Status: 401 Unauthorized\r\nWWW-Authenticate: Basic realm=\"Private access\"\r\n\r")
#!{{ python_executable }}
htpasswd_executable = "{{ htpasswd_executable }}"
htpasswd_path = "{{ htpasswd_path }}"
password_changed_once_path = "{{ password_changed_once_path }}"
import cgi
import cgitb
import os
import sys
cgitb.enable(display=0)
def sh(args):
os.system(" ".join(["'" + arg.replace("'", "'\\''") + "'" for arg in args]))
def touch(path):
open(path, "w").close()
def main():
form = cgi.FieldStorage()
password = form["password"].value
if sh([htpasswd_executable, "-b", htpasswd_path, "admin", password]):
sys.stdout.write("Status: 500 Internal Server Error\r\n\r\n")
return 1
touch(password_changed_once_path)
sys.stdout.write("Status: 204 No Content\r\n\r\n")
return 0
if __name__ == "__main__":
exit(main())
#!{{ python_executable }}
# Put this file in the software release
promise_wrapper_folder = "{{ promise_wrapper_folder }}"
import cgi
import cgitb
import os
cgitb.enable(display=0)
def main():
form = cgi.FieldStorage()
promise_name = form["service"].value
if "/" not in promise_name:
promise_path = os.path.join(promise_wrapper_folder, promise_name)
os.spawnl(os.P_NOWAIT, promise_path, promise_path)
print("Status: 204 No Content\r\n\r")
if __name__ == "__main__":
exit(main())
#!/usr/bin/env python
configuration_location = "%(configuration_location)s"
process_pid_file = "%(process_pid_file)s"
import sys
import os
import ConfigParser
import json
import subprocess
def loadConfig(config_file):
config = ConfigParser.ConfigParser()
config.read(config_file)
return config
def main():
config = loadConfig(configuration_location)
script_path = config.get("service", "script-path")
executable_folder = os.path.dirname(script_path)
executable = os.path.basename(script_path)
parameter_json = os.path.join(os.path.abspath(os.path.dirname(__file__)),
'parameters_%%s.json' %% executable)
with open(parameter_json, 'w') as fjson:
fjson.write(json.dumps(dict(config.items("parameter"))))
process = subprocess.Popen(
[script_path, parameter_json],
stdin=None,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
)
with open(process_pid_file, "w") as pidfile:
pidfile.write(str(process.pid))
if __name__ == "__main__":
if len(sys.argv) == 1:
print "Use: %s Monitor_Config_File"
sys.exit(1)
sys.exit(main())
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment