summaryrefslogtreecommitdiffstats
path: root/cli/cli.py
diff options
context:
space:
mode:
authorRoberto Hueso Gómez <rhueso@soleta.eu>2020-07-08 11:47:48 +0200
committerRoberto Hueso Gómez <rhueso@soleta.eu>2020-07-08 13:38:50 +0200
commitf4e1bb767b98ef8370208c79123b6eafac5f4732 (patch)
tree1d616806dbf80468484af8e5e0029eec4ea04364 /cli/cli.py
parente3d30d23ff22bebb8e5ebf0e731aab4a14502cea (diff)
Add ogcli list hardware command
This requests GET /hardware by calling something like: ogcli list hardware --scope-id=6 It is important to notice that 'scope-id' must be a "computer" type scope id.
Diffstat (limited to 'cli/cli.py')
-rw-r--r--cli/cli.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/cli/cli.py b/cli/cli.py
index abdfca8..47ede6b 100644
--- a/cli/cli.py
+++ b/cli/cli.py
@@ -48,16 +48,18 @@ class OgCLI():
self.rest = OgREST(cfg['ip'], cfg['port'], cfg['api_token'])
def list(self, args):
- choices = ['clients', 'scopes', 'modes']
+ choices = ['clients', 'scopes', 'modes', 'hardware']
parser = argparse.ArgumentParser()
parser.add_argument('item', choices=choices)
- args = parser.parse_args(args)
+ parsed_args = parser.parse_args([args[0]])
- if args.item == 'clients':
+ if parsed_args.item == 'clients':
OgClient.list_clients(self.rest)
- elif args.item == 'modes':
+ elif parsed_args.item == 'hardware':
+ OgClient.list_client_hardware(self.rest, args[1:])
+ elif parsed_args.item == 'modes':
OgModes.list_available_modes(self.rest)
- elif args.item == 'scopes':
+ elif parsed_args.item == 'scopes':
OgScope.list_scopes(self.rest)
def set(self, args):