diff options
author | Alice Ferrazzi <alicef@gentoo.org> | 2017-07-13 17:50:43 +0900 |
---|---|---|
committer | Alice Ferrazzi <alicef@gentoo.org> | 2017-07-13 17:50:43 +0900 |
commit | 38af4f37a6d5034742d60afdee9a60f1d8d6182a (patch) | |
tree | 5087038c0a86df3deedea7299ee34d2d51781869 | |
parent | Added threading by default (diff) | |
download | elivepatch-38af4f37a6d5034742d60afdee9a60f1d8d6182a.tar.gz elivepatch-38af4f37a6d5034742d60afdee9a60f1d8d6182a.tar.bz2 elivepatch-38af4f37a6d5034742d60afdee9a60f1d8d6182a.zip |
don't error exit the server but instead send back a error message if the livepatch is not ready
-rw-r--r-- | elivepatch_server/resources/dispatcher.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/elivepatch_server/resources/dispatcher.py b/elivepatch_server/resources/dispatcher.py index c7804ab..56340ec 100644 --- a/elivepatch_server/resources/dispatcher.py +++ b/elivepatch_server/resources/dispatcher.py @@ -125,10 +125,14 @@ class SendLivePatch(Resource): # Getting livepatch build status livepatch_full_path = os.path.join(uuid_dir, 'kpatch-'+livepatch_name) - with open(livepatch_full_path, 'rb') as fp: - response = make_response(fp.read()) - response.headers['content-type'] = 'application/octet-stream' - return response + try: + with open(livepatch_full_path, 'rb') as fp: + response = make_response(fp.read()) + response.headers['content-type'] = 'application/octet-stream' + return response + except: + return make_response(jsonify({'message': 'These are not the \ + patches you are looking for'}), 403) def post(self): return make_response(jsonify({'message': 'These are not the \ |