diff options
author | Jose M. Guisado <jguisado@soleta.eu> | 2021-02-26 14:44:13 +0100 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2021-02-26 15:34:02 +0100 |
commit | f6fa7958035164029e3a20b6ac8959811e16b7eb (patch) | |
tree | f2185d9c062859a764cbc64bee0b41c08fc771da /cli/objects | |
parent | 015a43ac3a418c074dbcd5bf64f4f6e20d9be021 (diff) |
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.
Diffstat (limited to 'cli/objects')
-rw-r--r-- | cli/objects/client.py | 17 |
1 files changed, 8 insertions, 9 deletions
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()) |