aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlice Ferrazzi <alicef@gentoo.org>2017-07-15 20:36:32 +0900
committerAlice Ferrazzi <alicef@gentoo.org>2017-07-15 20:36:32 +0900
commitb957e8e0410e45389cff1425eba538b4c70c1401 (patch)
tree14644b58a710ad268f9fc2bc8059a38bc4a8f714 /elivepatch_client/client
parentrefactored (diff)
downloadelivepatch-b957e8e0410e45389cff1425eba538b4c70c1401.tar.gz
elivepatch-b957e8e0410e45389cff1425eba538b4c70c1401.tar.bz2
elivepatch-b957e8e0410e45389cff1425eba538b4c70c1401.zip
moving uuid functions to the client as RFC 4122
A UUID is 128 bits long, and requires no central registration process.
Diffstat (limited to 'elivepatch_client/client')
-rw-r--r--elivepatch_client/client/checkers.py11
-rw-r--r--elivepatch_client/client/restful.py8
2 files changed, 15 insertions, 4 deletions
diff --git a/elivepatch_client/client/checkers.py b/elivepatch_client/client/checkers.py
index 439e722..d437aa6 100644
--- a/elivepatch_client/client/checkers.py
+++ b/elivepatch_client/client/checkers.py
@@ -6,6 +6,7 @@
import gzip
import shelve
+import uuid
import os
import os.path
@@ -15,7 +16,15 @@ from git import Repo
from elivepatch_client.client import restful
+def id_generate_uuid():
+ generated_uuid = str(uuid.uuid4())
+ return generated_uuid
+
+
class Kernel(object):
+ """
+ Class for manage the kernels files
+ """
def __init__(self, restserver_url):
self.config = ''
@@ -23,7 +32,7 @@ class Kernel(object):
self.restserver_url = restserver_url
self.kernel_version = None
self.rest_manager = restful.ManaGer(self.restserver_url, self.kernel_version)
- self.uuid = None
+ self.uuid = id_generate_uuid()
def set_config(self, config_path):
self.config = config_path
diff --git a/elivepatch_client/client/restful.py b/elivepatch_client/client/restful.py
index 2f7008a..938fa5f 100644
--- a/elivepatch_client/client/restful.py
+++ b/elivepatch_client/client/restful.py
@@ -10,6 +10,9 @@ import shutil
class ManaGer(object):
+ """
+ RESTful client functions
+ """
def __init__(self, server_url, kernel_version):
self.server_url = server_url
@@ -19,10 +22,10 @@ class ManaGer(object):
def set_uuid(self, uuid):
self.uuid = uuid
-
+
def set_kernel_version(self, kernel_version):
self.kernel_version = kernel_version
-
+
def get_kernel_version(self):
return self.kernel_version
@@ -84,4 +87,3 @@ class ManaGer(object):
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'))
-