aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlice Ferrazzi <alicef@gentoo.org>2017-07-01 10:45:10 +0000
committerAlice Ferrazzi <alicef@gentoo.org>2017-07-01 10:45:10 +0000
commitceda3a6e9e437b8396b9b360198d6e3522e33af5 (patch)
tree04d2604e464a68039944d13d4095d9c48d9d698c
parentstart adding userID section for parallel compiling (diff)
downloadelivepatch-ceda3a6e9e437b8396b9b360198d6e3522e33af5.tar.gz
elivepatch-ceda3a6e9e437b8396b9b360198d6e3522e33af5.tar.bz2
elivepatch-ceda3a6e9e437b8396b9b360198d6e3522e33af5.zip
add UserID for parallel build and minor fix
-rw-r--r--elivepatch_server/resources/dispatcher.py48
1 files changed, 35 insertions, 13 deletions
diff --git a/elivepatch_server/resources/dispatcher.py b/elivepatch_server/resources/dispatcher.py
index 56407c7..65b0b59 100644
--- a/elivepatch_server/resources/dispatcher.py
+++ b/elivepatch_server/resources/dispatcher.py
@@ -5,8 +5,8 @@
# Distributed under the terms of the GNU General Public License v2 or later
-from flask import Flask, jsonify, abort, make_response
-from flask_restful import Api, Resource, reqparse, fields, marshal
+from flask import jsonify, make_response
+from flask_restful import Resource, reqparse, fields, marshal
import werkzeug
from elivepatch_server.resources.livepatch import PaTch
@@ -47,7 +47,7 @@ class BuildLivePatch(Resource):
pass
def get(self):
- #lpatch.build_livepatch(kernel_dir, kernel_dir + '/vmlinux')
+ # lpatch.build_livepatch(kernel_dir, kernel_dir + '/vmlinux')
return {'packs': [marshal(pack, pack_fields) for pack in packs]}
def post(self):
@@ -57,7 +57,7 @@ class BuildLivePatch(Resource):
if kernel_config and kernel_patch:
lpatch.set_lp_status('working')
print("build livepatch: " + str(args))
- #lpatch.build_livepatch(kernel_dir, kernel_dir + '/vmlinux')
+ # lpatch.build_livepatch(kernel_dir, kernel_dir + '/vmlinux')
pack = {
'id': packs['id'] + 1,
'KernelVersion': args['KernelVersion'],
@@ -96,8 +96,8 @@ class GetLivePatch(Resource):
def post(self):
return make_response(jsonify({'message': 'These are not the \
- patches you are looking for'})
- , 403)
+ patches you are looking for'}), 403)
+
class GetConfig(Resource):
@@ -117,14 +117,14 @@ class GetConfig(Resource):
def get(self):
return make_response(jsonify({'message': 'These are not the \
- patches you are looking for'})
- , 403)
+ patches you are looking for'}), 403)
def post(self):
args = self.reqparse.parse_args()
print("get config: " + str(args))
parse = reqparse.RequestParser()
- parse.add_argument('file', type=werkzeug.datastructures.FileStorage, location='files')
+ parse.add_argument('file', type=werkzeug.datastructures.FileStorage,
+ location='files')
args = parse.parse_args()
audioFile = args['file']
audioFile_name = args['file'].filename
@@ -152,18 +152,40 @@ class GetPatch(Resource):
def get(self):
return make_response(jsonify({'message': 'These are not the \
- patches you are looking for'})
- , 403)
+ patches you are looking for'}), 403)
def post(self):
args = self.reqparse.parse_args()
print("get patch: " + str(args))
parse = reqparse.RequestParser()
- parse.add_argument('file', type=werkzeug.datastructures.FileStorage, location='files')
+ parse.add_argument('file', type=werkzeug.datastructures.FileStorage,
+ location='files')
args = parse.parse_args()
audioFile = args['file']
audioFile_name = args['file'].filename
print(audioFile_name)
print(audioFile)
audioFile.save(audioFile_name)
- lpatch.set_patch(audioFile_name) \ No newline at end of file
+ lpatch.set_patch(audioFile_name)
+
+
+class GetID(Resource):
+
+ def __init__(self):
+ self.reqparse = reqparse.RequestParser()
+ self.reqparse.add_argument('UserID', type=str, required=False,
+ help='No task title provided',
+ location='json')
+ super(GetID, self).__init__()
+ pass
+
+ def get(self):
+ return make_response(jsonify({'message': 'These are not the \
+ patches you are looking for'}), 403)
+
+ def post(self):
+ args = self.reqparse.parse_args()
+ print("get ID: " + str(args))
+
+
+#def id_check()