From 4015174300bf5e15eee6c62f9bae84dc1ab17317 Mon Sep 17 00:00:00 2001 From: Alejandro Sirgo Rica Date: Thu, 7 Nov 2024 16:26:55 +0100 Subject: cli: add live management commands Add new parameters to the config file ogcli.json with the following default values: 'local_live': '/var/www/html/ogrelive' 'server_live': 'https://opengnsys.soleta.eu/ogrelive' 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 list live --remote --- cli/cli.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'cli/cli.py') 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 -- cgit v1.2.3-18-g5258