From f6fa7958035164029e3a20b6ac8959811e16b7eb Mon Sep 17 00:00:00 2001 From: "Jose M. Guisado" Date: Fri, 26 Feb 2021 14:44:13 +0100 Subject: Bring clients.py up to date with ogServer API get_client_properties is not using a valid API resource to fetch computer details. Use /client/info. list_client_hardware is not building a valid payload. Drop payload building using 'scope' as key and updates o that its uses "{ client : ip }" scheme for specifying a client. This is the standard way of specifying a client in ogServer. --- cli/objects/client.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'cli/objects') diff --git a/cli/objects/client.py b/cli/objects/client.py index e7e3d31..5b2b1a9 100644 --- a/cli/objects/client.py +++ b/cli/objects/client.py @@ -18,27 +18,26 @@ class OgClient(): @staticmethod def list_client_hardware(rest, args): parser = argparse.ArgumentParser() - parser.add_argument('--scope-id', + parser.add_argument('--client', nargs=1, + type=str, required=True, - help='ID of the computer scope') + help='client IP') parsed_args = parser.parse_args(args) - payload = {'scope': {'id': int(parsed_args.scope_id[0]), - 'type': 'computer'}} + payload = {'client': parsed_args.client} r = rest.get('/hardware', payload=payload) print(r.json()) @staticmethod def get_client_properties(rest, args): parser = argparse.ArgumentParser() - parser.add_argument('--id', + parser.add_argument('--client', nargs=1, required=True, - help='ID of the computer scope') + help='client IP') parsed_args = parser.parse_args(args) - payload = {'scope': {'id': int(parsed_args.id[0]), - 'type': 'computer'}} - r = rest.get('/client/properties', payload=payload) + payload = {'client': parsed_args.client} + r = rest.get('/client/info', payload=payload) print(r.json()) -- cgit v1.2.3-18-g5258