aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlice Ferrazzi <alicef@gentoo.org>2017-07-14 03:41:50 +0900
committerAlice Ferrazzi <alicef@gentoo.org>2017-07-14 03:41:50 +0900
commita1ba3c7e3a88e213375cf9edc6fcba690b7b93eb (patch)
treeffd28dd8cca6b28990cd32ef4350cf78598adb9d
parentChanged UserID with UUID for clarity (diff)
downloadelivepatch-a1ba3c7e3a88e213375cf9edc6fcba690b7b93eb.tar.gz
elivepatch-a1ba3c7e3a88e213375cf9edc6fcba690b7b93eb.tar.bz2
elivepatch-a1ba3c7e3a88e213375cf9edc6fcba690b7b93eb.zip
refactoredHEADmaster
-rw-r--r--elivepatch_client/client/restful.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/elivepatch_client/client/restful.py b/elivepatch_client/client/restful.py
index 93bb0b4..2f7008a 100644
--- a/elivepatch_client/client/restful.py
+++ b/elivepatch_client/client/restful.py
@@ -4,7 +4,6 @@
# (c) 2017, Alice Ferrazzi <alice.ferrazzi@gmail.com>
# Distributed under the terms of the GNU General Public License v2 or later
-import time
import requests
import os
import shutil
@@ -15,6 +14,7 @@ class ManaGer(object):
def __init__(self, server_url, kernel_version):
self.server_url = server_url
self.kernel_version = kernel_version
+ # universally unique identifier for multi-threading
self.uuid = None
def set_uuid(self, uuid):
@@ -32,7 +32,6 @@ class ManaGer(object):
def version(self):
url = self.server_url + '/elivepatch/api/v1.0/agent'
r = requests.get(url)
- print(r.text)
print(r.json())
def send_file(self, config_send_file, patch_send_file, config_file_name, patch_file_name, api):
@@ -53,7 +52,6 @@ class ManaGer(object):
r_dict = r.json()
return r_dict
-
def build_livepatch(self):
url = self.server_url+'/elivepatch/api/v1.0/build_livepatch'
payload = {
@@ -61,7 +59,6 @@ class ManaGer(object):
'UUID' : self.uuid
}
r = requests.post(url, json=payload)
- # print(r.text)
print(r.json())
def get_livepatch(self):
@@ -83,8 +80,8 @@ class ManaGer(object):
print('livepatch not found')
r.close()
- elivepatch_dir = os.path.join('..', 'elivepatch-'+ self.uuid)
- if not os.path.exists(elivepatch_dir):
- os.makedirs(elivepatch_dir)
- shutil.move("myfile.ko", os.path.join(elivepatch_dir, 'livepatch.ko'))
+ elivepatch_uuid_dir = os.path.join('..', 'elivepatch-'+ self.uuid)
+ if not os.path.exists(elivepatch_uuid_dir):
+ os.makedirs(elivepatch_uuid_dir)
+ shutil.move("myfile.ko", os.path.join(elivepatch_uuid_dir, 'livepatch.ko'))