summaryrefslogtreecommitdiffstats
path: root/cli/cli.py
diff options
context:
space:
mode:
authorAlejandro Sirgo Rica <asirgo@soleta.eu>2024-11-07 16:26:55 +0100
committerAlejandro Sirgo Rica <asirgo@soleta.eu>2024-11-11 12:16:04 +0100
commit38f373addb05b14abb8de6c29408a4fe215a5bbc (patch)
tree32a8d4204f24bc906944959bb668e92368248d3f /cli/cli.py
parenta219bc7ff729516aea7ddea8516b50d96e7d9363 (diff)
cli: add live management commands
Add command to install the files of a live system. Example: ogcli install live --name ogrelive-6.1.0-26 Perform an update if live files are already present. Add command to delete the files of a live system. Example: ogcli delete live --name ogrelive-6.1.0-26 Update ogcli list live to show the lives in the server when invoked with the --remote flag. Example: ogcli live live --remote
Diffstat (limited to 'cli/cli.py')
-rw-r--r--cli/cli.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/cli/cli.py b/cli/cli.py
index 11d1521..0e34cd0 100644
--- a/cli/cli.py
+++ b/cli/cli.py
@@ -113,7 +113,7 @@ class OgCLI():
elif parsed_args.item == 'servers':
ret = OgServer.list_servers(self.rest)
elif parsed_args.item == 'live':
- ret = OgLive.list_live(self.rest)
+ ret = OgLive.list_live(self.rest, args[1:])
return ret
def set(self, args):
@@ -231,7 +231,7 @@ class OgCLI():
return ret
def delete(self, args):
- choices = ['server', 'repo', 'center', 'room', 'client', 'folder']
+ choices = ['server', 'repo', 'center', 'room', 'client', 'folder', 'live']
parser = argparse.ArgumentParser(prog='ogcli delete')
parser.add_argument('delete_obj', choices=choices)
@@ -253,6 +253,8 @@ class OgCLI():
ret = OgClient.delete_client(self.rest, args[1:])
elif parsed_args.delete_obj == 'folder':
ret = OgFolder.delete_folder(self.rest, args[1:])
+ elif parsed_args.delete_obj == 'live':
+ ret = OgLive.delete_live(self.rest, args[1:])
return ret
def add(self, args):
@@ -280,3 +282,19 @@ class OgCLI():
elif parsed_args.add_obj == 'folder':
ret = OgFolder.add_folder(self.rest, args[1:])
return ret
+
+ def install(self, args):
+ choices = ['live']
+ parser = argparse.ArgumentParser(prog='ogcli install')
+ parser.add_argument('install_obj', choices=choices)
+
+ if not args:
+ print('Missing install subcommand', file=sys.stderr)
+ parser.print_help(file=sys.stderr)
+ return 1
+
+ parsed_args = parser.parse_args([args[0]])
+ ret = 0
+ if parsed_args.install_obj == 'live':
+ ret = OgLive.install_live(self.rest, args[1:])
+ return ret