summaryrefslogtreecommitdiffstats
path: root/cli/cli.py
diff options
context:
space:
mode:
authorJose M. Guisado <jguisado@soleta.eu>2021-04-06 12:57:10 +0200
committerOpenGnSys Support Team <soporte-og@soleta.eu>2021-04-06 13:16:46 +0200
commita576aeaf1ea685e78148fd468853c9ad10f4f7db (patch)
treec4e508b594a68a3ce02a9077011b25080ebbb700 /cli/cli.py
parent4dfb90cf5685129f9e86b448142e6d00b5964732 (diff)
Add 'create image'
Enables creation of images using /image/create from ogServer API. Summary of the options: --disk Disk number --part Partition number --name Image name which will be used for the .img file. --desc Description of the image. This option enables ogServer to store an entry in the database regarding this image. --repo Optional. Holds the ip address of the repo which will store the created image. Defaults to ogserver address specified inside ogcli.json --client-ip Client ip for which we want to create a partition image
Diffstat (limited to 'cli/cli.py')
-rw-r--r--cli/cli.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/cli/cli.py b/cli/cli.py
index f624761..77f7ac5 100644
--- a/cli/cli.py
+++ b/cli/cli.py
@@ -98,3 +98,12 @@ class OgCLI():
if parsed_args.send_obj == 'image':
OgImage.restore_image(self.rest, args[1:])
+
+ def create(self, args):
+ choices = ['image']
+ parser = argparse.ArgumentParser(prog='ogcli create')
+ parser.add_argument('create_obj', choices=choices)
+ parsed_args = parser.parse_args([args[0]])
+
+ if parsed_args.create_obj == 'image':
+ OgImage.create_image(self.rest, args[1:])