unique error codes for reverse proxy

This commit is contained in:
2019-10-06 14:50:37 +02:00
parent 58c14a50b7
commit 015cd9bcb7

View File

@@ -30,13 +30,13 @@ def rootPage():
# check for project in config # # check for project in config #
if not project or project not in config: if not project or project not in config:
return ("Rejected: project not identified in config", 400) return ("Rejected: project not identified in config", 401)
token, scriptName = config[project] token, scriptName = config[project]
# check authentification # # check authentification #
if TOKEN_HEADER not in flask.request.headers: if TOKEN_HEADER not in flask.request.headers:
return ("Rejected: secret token not found in request", 403) return ("Rejected: secret token not found in request", 402)
elif token != flask.request.headers[TOKEN_HEADER]: elif token != flask.request.headers[TOKEN_HEADER]:
return ("Rejected: secret token found but is mismatch", 403) return ("Rejected: secret token found but is mismatch", 403)
@@ -44,7 +44,7 @@ def rootPage():
try: try:
executeScript(scriptName) executeScript(scriptName)
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
return ("Failed: script execution on the server failed", 500) return ("Failed: script execution on the server failed", 501)
# signal successfull completion # # signal successfull completion #
return ("Success", 200) return ("Success", 200)