From aec6772edcc65d2a1966719f499d2427d9973376 Mon Sep 17 00:00:00 2001 From: OpenGnSys Support Team Date: Wed, 28 Aug 2024 15:43:46 +0200 Subject: server: remove 'set server' command server IP is now inferred from what it is reachable, remove this command. this revisits a721957cc469 ('cli: add server commands') --- cli/cli.py | 4 +--- cli/objects/server.py | 38 -------------------------------------- 2 files changed, 1 insertion(+), 41 deletions(-) diff --git a/cli/cli.py b/cli/cli.py index 8e06c19..ed65a4f 100644 --- a/cli/cli.py +++ b/cli/cli.py @@ -109,7 +109,7 @@ class OgCLI(): OgLive.list_live(self.rest) def set(self, args): - choices = ['modes', 'mode', 'server', 'repo'] + choices = ['modes', 'mode', 'repo'] parser = argparse.ArgumentParser(prog='ogcli set') parser.add_argument('item', choices=choices) @@ -123,8 +123,6 @@ class OgCLI(): OgModes.set_modes(self.rest, args[1:]) elif parsed_args.item == 'repo': OgRepo.set_repo(self.rest, args[1:]) - elif parsed_args.item == 'server': - OgServer.set_server(self.rest, args[1:]) def request(self, args): choices = ['reboot', 'refresh', 'poweroff', 'wol', 'session'] diff --git a/cli/objects/server.py b/cli/objects/server.py index d0b13d0..a2f299d 100644 --- a/cli/objects/server.py +++ b/cli/objects/server.py @@ -38,41 +38,3 @@ class OgServer(): parsed_args = parser.parse_args(args) payload = {'id': parsed_args.id} rest.delete('/server', payload=payload) - - @staticmethod - def set_server(rest, args): - parser = argparse.ArgumentParser(prog='ogcli set server') - parser.add_argument('--id', - type=int, - nargs='?', - required=True, - help='server id in the database') - group = parser.add_argument_group('clients', 'Client selection args') - group.add_argument('--room-id', - type=int, - action='append', - default=[], - required=False, - help='Clients from given room id') - group.add_argument('--client-ip', - action='append', - default=[], - required=False, - help='Any valid client IP') - parsed_args = parser.parse_args(args) - - r = rest.get('/scopes') - scopes = r.json() - ips = set() - - for room in parsed_args.room_id: - room_scope = scope_lookup(room, 'room', scopes) - ips.update(ips_in_scope(room_scope)) - for l in parsed_args.client_ip: - ips.add(l) - if not ips: - print('Missing --client-ip or --room-id. No clients provided.') - return - - payload = {'id': parsed_args.id, 'clients': list(ips)} - rest.post('/client/server', payload=payload) -- cgit v1.2.3-18-g5258