aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlice Ferrazzi <alicef@gentoo.org>2017-07-01 04:06:54 +0900
committerAlice Ferrazzi <alicef@gentoo.org>2017-07-01 04:06:54 +0900
commit8e05dcdc35a9c56983a9b77cdfcb49a7fa7cd314 (patch)
tree44a6e32cff49bac06364192ec8c537de0f1f7c81 /elivepatch_client/client/restful.py
parentchecking file extension using regular expression (diff)
downloadelivepatch-8e05dcdc35a9c56983a9b77cdfcb49a7fa7cd314.tar.gz
elivepatch-8e05dcdc35a9c56983a9b77cdfcb49a7fa7cd314.tar.bz2
elivepatch-8e05dcdc35a9c56983a9b77cdfcb49a7fa7cd314.zip
dynamically passing kernel version
Diffstat (limited to 'elivepatch_client/client/restful.py')
-rw-r--r--elivepatch_client/client/restful.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/elivepatch_client/client/restful.py b/elivepatch_client/client/restful.py
index 60c89a3..0aee10d 100644
--- a/elivepatch_client/client/restful.py
+++ b/elivepatch_client/client/restful.py
@@ -10,8 +10,9 @@ from requests.auth import HTTPBasicAuth
import time
class ManaGer(object):
- def __init__(self, server_url):
+ def __init__(self, server_url, kernel_version):
self.server_url = server_url
+ self.kernel_version = kernel_version
def version(self):
url = self.server_url + '/elivepatch/api/v1.0/agent'
@@ -27,7 +28,7 @@ class ManaGer(object):
def build_livepatch(self):
url = self.server_url+'/elivepatch/api/v1.0/build_livepatch'
payload = {
- 'KernelVersion': '4.10.16'
+ 'KernelVersion': self.kernel_version
}
r = requests.post(url, json=payload)
print(r.text)
@@ -37,7 +38,7 @@ class ManaGer(object):
from io import BytesIO
url = self.server_url+'/elivepatch/api/v1.0/get_livepatch'
payload = {
- 'KernelVersion': '4.10.16'
+ 'KernelVersion': self.kernel_version
}
r = requests.get(url)
if r.status_code == requests.codes.ok: # livepatch returned ok