Handle missing test cases pages
In case of requesting an non existent test case the following exception is triggered:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/waitress/channel.py", line 428, in service
task.service()
File "/usr/local/lib/python3.9/dist-packages/waitress/task.py", line 168, in service
self.execute()
File "/usr/local/lib/python3.9/dist-packages/waitress/task.py", line 436, in execute
app_iter = self.channel.server.application(environ, start_response)
File "/usr/local/lib/python3.9/dist-packages/waitress/proxy_headers.py", line 64, in translate_proxy_headers
return app(environ, start_response)
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1498, in __call__
return self.wsgi_app(environ, start_response)
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1476, in wsgi_app
response = self.handle_exception(e)
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1473, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 882, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 880, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 865, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
File "/app/./webhook.py", line 292, in testcases_definition
tc_file_data = testcases_table.get_tc_data(release, testcase + ".yaml")
File "/app/data/testcases_table.py", line 184, in get_tc_data
return self.get_index_files_data()[release][tc_file]
KeyError: 'iptables-nmap.yaml'
To avoid this type of messages handle gracefully the query for non existent test cases.
Signed-off-by: Walter Lozano walter.lozano@collabora.com
Edited by Walter Lozano