aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlice Ferrazzi <alicef@gentoo.org>2017-07-24 11:21:14 +0900
committerAlice Ferrazzi <alicef@gentoo.org>2017-07-24 11:21:14 +0900
commitb4ad5a64ae2717658a484666b3adc12bb31cf354 (patch)
treed15f52797c58744e43de2bdf026d60e9ed51995e
parentcatch missing livepatch errors on the client (diff)
downloadelivepatch-b4ad5a64ae2717658a484666b3adc12bb31cf354.tar.gz
elivepatch-b4ad5a64ae2717658a484666b3adc12bb31cf354.tar.bz2
elivepatch-b4ad5a64ae2717658a484666b3adc12bb31cf354.zip
catch gentoo-sources not available error
-rw-r--r--elivepatch_server/resources/dispatcher.py4
-rw-r--r--elivepatch_server/resources/livepatch.py3
2 files changed, 6 insertions, 1 deletions
diff --git a/elivepatch_server/resources/dispatcher.py b/elivepatch_server/resources/dispatcher.py
index d470cd7..70a62d7 100644
--- a/elivepatch_server/resources/dispatcher.py
+++ b/elivepatch_server/resources/dispatcher.py
@@ -72,7 +72,9 @@ class BuildLivePatch(Resource):
if args['KernelVersion']:
print("build livepatch: " + str(args))
# check vmlinux presence if not rebuild the kernel
- lpatch.get_kernel_sources(args['UUID'], args['KernelVersion'])
+ kernel_sources_status = lpatch.get_kernel_sources(args['UUID'], args['KernelVersion'])
+ if not kernel_sources_status:
+ return make_response(jsonify({'message': 'gentoo-sources not available'}), 403)
lpatch.build_livepatch(args['UUID'], 'vmlinux')
pack = {
'id': packs['id'] + 1,
diff --git a/elivepatch_server/resources/livepatch.py b/elivepatch_server/resources/livepatch.py
index 46c6fab..bba1491 100644
--- a/elivepatch_server/resources/livepatch.py
+++ b/elivepatch_server/resources/livepatch.py
@@ -60,8 +60,11 @@ class PaTch(object):
print(ebuild_path)
if os.path.isfile(ebuild_path):
command(['sudo', 'ROOT=/tmp/elivepatch-' + uuid, 'ebuild', ebuild_path, 'clean', 'merge'])
+ kernel_sources_status = True
else:
print('ebuild not present')
+ kernel_sources_status = None
+ return kernel_sources_status
def build_kernel(self, uuid):
kernel_source_dir = '/tmp/elivepatch-' + uuid + '/usr/src/linux/'