mirror of https://git.48k.eu/ogcli/
Rework ogcli set mode command
This patch adapts the command to the fixed POST /modes request. It can now be called with something like: ogcli set modes --scope-name=pc12 --mode=pxe NOTE: This inherits from the legacy setclientmode script and requires scope names to be unique. This should be fixed in the future in case it's convenient to have duplicated scope names.master
parent
513308fe81
commit
adb2e9ffba
|
@ -18,21 +18,16 @@ class OgModes():
|
|||
@staticmethod
|
||||
def set_modes(rest, args):
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--scope-id',
|
||||
parser.add_argument('--scope-name',
|
||||
nargs=1,
|
||||
required=True,
|
||||
help='ID of the scope')
|
||||
parser.add_argument('--scope-type',
|
||||
nargs=1,
|
||||
required=True,
|
||||
help='Type of the scope')
|
||||
help='Name of the scope (room or computer)')
|
||||
parser.add_argument('--mode',
|
||||
nargs=1,
|
||||
required=True,
|
||||
help='Mode for the scope')
|
||||
parsed_args = parser.parse_args(args)
|
||||
|
||||
payload = {'scope': {'id': int(parsed_args.scope_id[0]),
|
||||
'type': parsed_args.scope_type[0]},
|
||||
payload = {'scope_name': parsed_args.scope_name[0],
|
||||
'mode': parsed_args.mode[0]}
|
||||
r = rest.post('/modes', payload=payload)
|
||||
|
|
Loading…
Reference in New Issue