mirror of https://git.48k.eu/ogcli/
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.master
parent
015a43ac3a
commit
f6fa795803
|
@ -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())
|
||||
|
|
Loading…
Reference in New Issue