[projects/pld-builder.new] Provide http and https interfaces by default.

arekm arekm at pld-linux.org
Mon Nov 10 15:23:32 CET 2014


commit 90e782ca5b39466ed2d4fffa93297456330fb577
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Mon Nov 10 15:23:28 2014 +0100

    Provide http and https interfaces by default.

 PLD_Builder/config.py                 |  1 +
 PLD_Builder/request_handler_server    |  9 +++++----
 PLD_Builder/request_handler_server.py | 11 ++++++++---
 config/builder.conf.dist              |  3 +--
 4 files changed, 15 insertions(+), 9 deletions(-)
---
diff --git a/PLD_Builder/config.py b/PLD_Builder/config.py
index 967f7c3..84d6d7b 100644
--- a/PLD_Builder/config.py
+++ b/PLD_Builder/config.py
@@ -75,6 +75,7 @@ class Builder_Conf:
         self.request_handler_server_port = int(get("port", d=1234, sec="request-server"))
         self.request_handler_server_ssl = get("ssl", d="False", sec="request-server")
         if self.request_handler_server_ssl:
+            self.request_handler_server_ssl_port = int(get("port", d=1235, sec="request-server"))
             self.request_handler_server_ssl_key = get("ssl_key", d="", sec="request-server")
             self.request_handler_server_ssl_cert = get("ssl_cert", d="", sec="request-server")
             self.request_handler_server_ssl_cacert = get("ssl_cacert", d="", sec="request-server")
diff --git a/PLD_Builder/request_handler_server b/PLD_Builder/request_handler_server
index 4abb47d..0c1f265 100755
--- a/PLD_Builder/request_handler_server
+++ b/PLD_Builder/request_handler_server
@@ -24,16 +24,17 @@ if [ $daemon = 0 -a $attach = 0 ]; then
 fi
 
 if [ "$daemon" = 1 ]; then
-	echo "Starting request_handler_server"
+	echo "Starting request_handler_server(s)"
 	rm -f $sock
 	cd $(dirname $sock)
-	exec dtach -n $(basename $sock) -r none python request_handler_server.py
+	tmux -S $sock new-session -d -s "request_handler_server" -n "http" "python request_handler_server.py" && \
+		exec tmux -S $sock new-window -d -t "request_handler_server" -n "https" "python request_handler_server.py ssl"
 	exit 1
 fi
 
 # attach to session
 if [ "$attach" = 1 ]; then
-	echo "Attaching to request_handler_server"
-	exec dtach -a $sock
+	echo "Attaching to request_handler_server(s)"
+	exec tmux -S $sock attach
 	exit 1
 fi
diff --git a/PLD_Builder/request_handler_server.py b/PLD_Builder/request_handler_server.py
index 474ee02..810fa7e 100644
--- a/PLD_Builder/request_handler_server.py
+++ b/PLD_Builder/request_handler_server.py
@@ -83,7 +83,7 @@ def write_js():
 	r.close()
 	os.umask(old_umask)
 
-def main():
+def main(srv_ssl=False):
 	write_css();
 	write_js();
 	socket.setdefaulttimeout(30)
@@ -91,7 +91,8 @@ def main():
 		init_conf()
 		host = ""
 		port = config.request_handler_server_port
-		srv_ssl = config.request_handler_server_ssl
+		if srv_ssl:
+			port = config.request_handler_server_ssl_port
 
 		try:
 			server = HTTPServer((host, port), MyHandler)
@@ -113,5 +114,9 @@ def main():
 		server.socket.close()
 
 if __name__ == '__main__':
-	main()
+	srv_ssl = False
+	if len(sys.argv) == 2 and sys.argv[1] == "ssl":
+		srv_ssl = True
+
+	main(srv_ssl)
 
diff --git a/config/builder.conf.dist b/config/builder.conf.dist
index 18d5caa..3c5638f 100644
--- a/config/builder.conf.dist
+++ b/config/builder.conf.dist
@@ -65,8 +65,7 @@ rpm_cache_dir = /spools/ready
 tag_prefixes = auto-th-
 
 [request-server]
-port = 1234
-ssl = False
+ssl_port = 1235
 ssl_key = somewhere/srcbuilder.key
 ssl_cert = somewhere/srcbuilder.crt
 ssl_cacert = somewhere/intermediateca.crt
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/pld-builder.new.git/commitdiff/90e782ca5b39466ed2d4fffa93297456330fb577



More information about the pld-cvs-commit mailing list