diff options
author | 2017-07-28 03:55:25 +0900 | |
---|---|---|
committer | 2017-07-28 03:55:25 +0900 | |
commit | 679d3d29139f150fc7cb5cc0e9c8255ec5d5da85 (patch) | |
tree | fa62d251dc1ecd2d34cc2363681390b82c8b780e | |
parent | fix message for cve option (diff) | |
download | elivepatch-679d3d29139f150fc7cb5cc0e9c8255ec5d5da85.tar.gz elivepatch-679d3d29139f150fc7cb5cc0e9c8255ec5d5da85.tar.bz2 elivepatch-679d3d29139f150fc7cb5cc0e9c8255ec5d5da85.zip |
adding incremental patches feature in progress
- made function for list and save patches
-rw-r--r-- | elivepatch_client/client/cli.py | 8 | ||||
-rw-r--r-- | elivepatch_client/client/patch.py | 24 |
2 files changed, 30 insertions, 2 deletions
diff --git a/elivepatch_client/client/cli.py b/elivepatch_client/client/cli.py index 4518b48..76a3f87 100644 --- a/elivepatch_client/client/cli.py +++ b/elivepatch_client/client/cli.py @@ -7,8 +7,10 @@ import sys from elivepatch_client.client.checkers import Kernel -from elivepatch_client.client.restful import ManaGer +from elivepatch_client.client import restful from elivepatch_client.client.version import VERSION +from elivepatch_client.client import patch + if sys.hexversion >= 0x30200f0: ALL_KEYWORD = b'ALL' @@ -30,6 +32,8 @@ class Main(object): if config.cve: print('Kernel security CVE check is not implemented yet') elif config.patch: + patch_manager = patch.ManaGer() + patch_manager.list() current_kernel = Kernel(config.url) current_kernel.set_config(config.config) current_kernel.set_patch(config.patch) @@ -48,5 +52,5 @@ you need at list --patch or --cve') pass def send_config(self): - server = ManaGer(self.url) + server = restful.ManaGer(self.url) pass diff --git a/elivepatch_client/client/patch.py b/elivepatch_client/client/patch.py new file mode 100644 index 0000000..ba086b5 --- /dev/null +++ b/elivepatch_client/client/patch.py @@ -0,0 +1,24 @@ + +import os + + +class ManaGer(object): + + def __init__(self): + self.tmp_patch = os.path.join('/tmp', 'elivepatch') + if not os.path.exists(self.tmp_patch): + os.mkdir(self.tmp_patch) + + def list(self): + patch_filename = [] + for (dirpath, dirnames, filenames) in os.walk(self.tmp_patch): + patch_filename.extend(filenames) + break + print('List of current patches:') + print(patch_filename) + + def save(self, patch): + i = 0 + while os.path.exists("elivepatch_%s.patch" % i): + i += 1 + fh = open("elivepatch_%s.patch" % i, "w")
\ No newline at end of file |