Skip to content
Permalink
Browse files
Allow localhost graceful shutdown (#3650)
* Allow localhost graceful shutdown

* Update heron/shell/src/python/handlers/killexecutorhandler.py

Co-authored-by: Oliver Bristow <evilumbrella+github@gmail.com>

Co-authored-by: Oliver Bristow <evilumbrella+github@gmail.com>
  • Loading branch information
thinker0 and Code0x58 committed Jan 11, 2021
1 parent b363319 commit 6edbee7c52e133467d4ba3277c3726b33188ef5b
Showing 1 changed file with 4 additions and 1 deletion.
@@ -44,13 +44,16 @@ def kill_parent():
logger.info("Killing parent executor")
os.killpg(os.getppid(), signal.SIGTERM)

def is_local():
return self.request.remote_ip in ('localhost', '127.0.0.1', '::1')

logger = logging.getLogger(__file__)
logger.info("Received 'Killing process' request")
data = dict(parse_qsl(self.request.body))

# check shared secret
sharedSecret = data.get('secret')
if sharedSecret != options.secret:
if not is_local() and sharedSecret != options.secret:
status_finish(403)
return

0 comments on commit 6edbee7

Please sign in to comment.