aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlice Ferrazzi <alicef@gentoo.org>2017-07-17 11:48:49 +0900
committerAlice Ferrazzi <alicef@gentoo.org>2017-07-17 11:48:49 +0900
commit9345a566c1ac902f9ec5af5e800f4f646f2f5c7b (patch)
treeda3308d62e3ff88a13200a67349140f759791894
parentapi link added to variable (diff)
downloadelivepatch-9345a566c1ac902f9ec5af5e800f4f646f2f5c7b.tar.gz
elivepatch-9345a566c1ac902f9ec5af5e800f4f646f2f5c7b.tar.bz2
elivepatch-9345a566c1ac902f9ec5af5e800f4f646f2f5c7b.zip
added todo cases
-rw-r--r--elivepatch_server/resources/dispatcher.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/elivepatch_server/resources/dispatcher.py b/elivepatch_server/resources/dispatcher.py
index 5344a51..f095e02 100644
--- a/elivepatch_server/resources/dispatcher.py
+++ b/elivepatch_server/resources/dispatcher.py
@@ -50,6 +50,7 @@ def check_uuid(uuid):
def get_uuid_dir(uuid):
return os.path.join('/tmp/', 'elivepatch-' + uuid)
+# TODO: move lpatch to per request scope instead of global scope
lpatch = PaTch()
kernel_dir = lpatch.get_kernel_dir()
@@ -179,14 +180,18 @@ class GetFiles(Resource):
patchfile_name = file_args['patch'].filename
configFile_name = os.path.join('/tmp','elivepatch-' + args['UUID'], configFile_name)
- if not os.path.exists('/tmp/elivepatch-' + args['UUID']):
+ if os.path.exists('/tmp/elivepatch-' + args['UUID']):
+ # TODO: case the path already exist
+ print('the folder: "/tmp/elivepatch-' + args['UUID'] + '" is already present')
+ pass
+ else:
+ print('creating: "/tmp/elivepatch-' + args['UUID'])
os.makedirs('/tmp/elivepatch-' + args['UUID'])
+
configFile.save(configFile_name)
lpatch.set_config(configFile_name)
patch_fulldir_name = os.path.join('/tmp','elivepatch-' + args['UUID'], patchfile_name)
- if not os.path.exists('/tmp/elivepatch-' + args['UUID']):
- os.makedirs('/tmp/elivepatch-' + args['UUID'])
patchfile.save(patch_fulldir_name)
lpatch.set_patch(patch_fulldir_name)
lpatch.set_patch_filename(patchfile_name)