summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJose M. Guisado <jguisado@soleta.eu>2021-03-30 10:49:37 +0200
committerOpenGnSys Support Team <soporte-og@soleta.eu>2021-03-30 14:00:25 +0200
commit5abe86222892be4c21fe0d041d2e05d07ddcd7bb (patch)
treebce25becfaa943df0891f35ee09a0a7298ff6c1c
parent40bd1463770929788f64ba32b892b6af3009f929 (diff)
Add list images
ogServer exposes a list of known partition images at /images, use it to implement 'list images' command.
-rw-r--r--cli/cli.py5
-rw-r--r--cli/objects/images.py14
2 files changed, 18 insertions, 1 deletions
diff --git a/cli/cli.py b/cli/cli.py
index 0e7c749..18fd36c 100644
--- a/cli/cli.py
+++ b/cli/cli.py
@@ -10,6 +10,7 @@ from cli.objects.client import OgClient
from cli.objects.scopes import OgScope
from cli.objects.modes import OgModes
from cli.objects.wol import OgWol
+from cli.objects.images import OgImage
import argparse
import requests
import sys
@@ -50,7 +51,7 @@ class OgCLI():
def list(self, args):
choices = ['clients', 'scopes', 'modes', 'hardware',
- 'client']
+ 'client', 'images']
parser = argparse.ArgumentParser(prog='ogcli list')
parser.add_argument('item', choices=choices)
parsed_args = parser.parse_args([args[0]])
@@ -65,6 +66,8 @@ class OgCLI():
OgModes.list_available_modes(self.rest)
elif parsed_args.item == 'scopes':
OgScope.list_scopes(self.rest)
+ elif parsed_args.item == 'images':
+ OgImage.list_images(self.rest)
def set(self, args):
choices = ['modes']
diff --git a/cli/objects/images.py b/cli/objects/images.py
new file mode 100644
index 0000000..94c6386
--- /dev/null
+++ b/cli/objects/images.py
@@ -0,0 +1,14 @@
+#
+# Copyright (C) 2021 Soleta Networks <info@soleta.eu>
+#
+# This program is free software: you can redistribute it and/or modify it under
+# the terms of the GNU Affero General Public License as published by the
+# Free Software Foundation, version 3.
+#
+
+class OgImage():
+
+ @staticmethod
+ def list_images(rest):
+ r = rest.get('/images')
+ print(r.text)