summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOpenGnSys Support Team <soporte-og@soleta.eu>2023-11-30 21:47:16 +0100
committerOpenGnSys Support Team <soporte-og@soleta.eu>2023-11-30 22:03:51 +0100
commitda8f8e8009741e92d5e5fd08b9a30bea96a385fb (patch)
tree052d2e6d8fee9670f3b5d79396a236c41f12cf7d
parent09cb99b057f26628320ecee789799adc04a0435c (diff)
client: support for deleting clients
Delete a client with command: $ ogcli delete client --ip 1.2.3.4
-rw-r--r--cli/cli.py4
-rw-r--r--cli/objects/client.py14
2 files changed, 17 insertions, 1 deletions
diff --git a/cli/cli.py b/cli/cli.py
index 95b0f82..8933b93 100644
--- a/cli/cli.py
+++ b/cli/cli.py
@@ -197,7 +197,7 @@ class OgCLI():
OgImage.update_image(self.rest, args[1:])
def delete(self, args):
- choices = ['server', 'center', 'room']
+ choices = ['server', 'center', 'room', 'client']
parser = argparse.ArgumentParser(prog='ogcli delete')
parser.add_argument('delete_obj', choices=choices)
@@ -213,6 +213,8 @@ class OgCLI():
OgCenter.delete_center(self.rest, args[1:])
elif parsed_args.delete_obj == 'room':
OgRoom.delete_room(self.rest, args[1:])
+ elif parsed_args.delete_obj == 'client':
+ OgClient.delete_client(self.rest, args[1:])
def add(self, args):
choices = ['server', 'repo', 'center', 'room', 'client']
diff --git a/cli/objects/client.py b/cli/objects/client.py
index d438742..58f8094 100644
--- a/cli/objects/client.py
+++ b/cli/objects/client.py
@@ -121,3 +121,17 @@ class OgClient():
'livedir': 'ogLive'
}
rest.post('/client/add', payload=payload)
+
+ @staticmethod
+ def delete_client(rest, args):
+ parser = argparse.ArgumentParser(prog='ogcli delete client')
+ parser.add_argument('--ip',
+ action='append',
+ default=[],
+ required=True,
+ help='Client IP')
+ parsed_args = parser.parse_args(args)
+ payload = {
+ 'clients': parsed_args.ip,
+ }
+ rest.post('/client/delete', payload=payload)