[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] 2 commits: reproducible: web scheduler: print debug info also in case of ValidationError
Mattia Rizzolo
gitlab at salsa.debian.org
Wed May 16 13:44:12 BST 2018
Mattia Rizzolo pushed to branch master at Debian QA / jenkins.debian.net
Commits:
e9931086 by Mattia Rizzolo at 2018-05-16T14:42:56+02:00
reproducible: web scheduler: print debug info also in case of ValidationError
Signed-off-by: Mattia Rizzolo <mattia at debian.org>
- - - - -
26dcd3a5 by Mattia Rizzolo at 2018-05-16T14:43:23+02:00
reproducible: web scheduler: add an X-Error-Message in case of ValidationError
Signed-off-by: Mattia Rizzolo <mattia at debian.org>
- - - - -
1 changed file:
- bin/cgi-bin/schedule
Changes:
=====================================
bin/cgi-bin/schedule
=====================================
--- a/bin/cgi-bin/schedule
+++ b/bin/cgi-bin/schedule
@@ -12,13 +12,23 @@ import subprocess
cgitb.enable()
+def debug_info():
+ # Debug info, to be removed once ready to go.
+ print()
+ print('WARNING: This endpoint is still a WORK IN PROGRESS. This means that the option details can change, and it will not commit any change.')
+ print('You are aunthenticated as: {}'.format(user))
+ print(cgi.FieldStorage())
+
+
class ValidationError(Exception):
def __init__(self, message):
super().__init__(message)
print('Status: 400 Bad Request')
- print('Content-Type: text/html; charset="utf-8"')
+ print('Content-Type: text/plain; charset="utf-8"')
+ print('X-Error-Message: {}'.format(message))
print()
print(message)
+ debug_info()
sys.exit()
@@ -131,8 +141,4 @@ else:
print()
cgitb.handler()
-# Debug info, to be removed once ready to go.
-print()
-print('WARNING: This endpoint is still a WORK IN PROGRESS. This means that the option details can change, and it will not commit any change.')
-print('You are aunthenticated as: {}'.format(user))
-print(cgi.FieldStorage())
+debug_info()
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/compare/9034bf1e6604bc1ad9cfc69e0331206c662a7ebf...26dcd3a5bb4a17d5f25058f9ffc1ed58d3821acd
---
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/compare/9034bf1e6604bc1ad9cfc69e0331206c662a7ebf...26dcd3a5bb4a17d5f25058f9ffc1ed58d3821acd
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/qa-jenkins-scm/attachments/20180516/1e3e837e/attachment-0001.html>
More information about the Qa-jenkins-scm
mailing list