From 28ad134414a8960a1a8f0a79491fc08d1f379d63 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Fri, 28 Aug 2020 08:51:47 -0400 Subject: [PATCH] Move deployment script to python3 --- manifests/07-downloads-deployment.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/manifests/07-downloads-deployment.yaml b/manifests/07-downloads-deployment.yaml index b33cea0b5d..d10698e67b 100644 --- a/manifests/07-downloads-deployment.yaml +++ b/manifests/07-downloads-deployment.yaml @@ -59,7 +59,7 @@ spec: - '-c' - | cat <>/tmp/serve.py - import BaseHTTPServer, errno, os, re, signal, SimpleHTTPServer, socket, sys, tarfile, tempfile, threading, time, zipfile + import errno, http.server, os, re, signal, socket, sys, tarfile, tempfile, threading, time, zipfile signal.signal(signal.SIGTERM, lambda signum, frame: sys.exit(0)) @@ -88,7 +88,7 @@ spec: self.start() def run(self): - httpd = BaseHTTPServer.HTTPServer(addr, SimpleHTTPServer.SimpleHTTPRequestHandler, False) + httpd = http.server.HTTPServer(addr, http.server.SimpleHTTPRequestHandler, False) # Prevent the HTTP server from re-binding every handler. # https://stackoverflow.com/questions/46210672/ @@ -135,7 +135,7 @@ spec: for directory in directories: write_index( path=os.path.join(root, directory, 'index.html'), - message='

Directory listings are disabled. See here for available content.

'.format(root_link), + message='

Directory listings are disabled. See here for available content.

'.format(root_link), ) write_index( path=os.path.join(root, 'index.html'), @@ -168,5 +168,5 @@ spec: [Thread(i, socket=sock) for i in range(100)] time.sleep(9e9) EOF - exec python2 /tmp/serve.py # the cli image only has Python 2.7 + exec python3 /tmp/serve.py terminationGracePeriodSeconds: 1