summaryrefslogtreecommitdiffstats
path: root/ipaclient
diff options
context:
space:
mode:
authorJan Cholasta <jcholast@redhat.com>2016-06-16 10:19:25 +0200
committerJan Cholasta <jcholast@redhat.com>2016-06-20 16:39:12 +0200
commitd0cfe37a7ebda848abd32fc46129e7844da5a9be (patch)
treee32311a7479428c2ea83d6f27942a944ec6337f2 /ipaclient
parent91faf3ecd7708409350c8c5961833cbde202b2b2 (diff)
downloadfreeipa-d0cfe37a7ebda848abd32fc46129e7844da5a9be.tar.gz
freeipa-d0cfe37a7ebda848abd32fc46129e7844da5a9be.tar.xz
freeipa-d0cfe37a7ebda848abd32fc46129e7844da5a9be.zip
schema: merge command args and options
Rather than having args and options separately in command schema, merge them together and use new `positional` param flag to differentiate between them. https://fedorahosted.org/freeipa/ticket/4739 Reviewed-By: David Kupka <dkupka@redhat.com>
Diffstat (limited to 'ipaclient')
-rw-r--r--ipaclient/remote_plugins/schema.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/ipaclient/remote_plugins/schema.py b/ipaclient/remote_plugins/schema.py
index 0ad2d25c6..25a2a7ec5 100644
--- a/ipaclient/remote_plugins/schema.py
+++ b/ipaclient/remote_plugins/schema.py
@@ -286,11 +286,8 @@ def _create_output(schema):
def _create_command(schema):
- name = str(schema['name'])
- params = {m['name']: _create_param(m) for m in schema['params']}
-
command = {}
- command['name'] = name
+ command['name'] = str(schema['name'])
if 'doc' in schema:
command['doc'] = ConcatenatedLazyText(schema['doc'])
if 'topic_topic' in schema:
@@ -304,9 +301,11 @@ def _create_command(schema):
if 'no_cli' in schema:
command['NO_CLI'] = schema['no_cli']
command['takes_args'] = tuple(
- params[n] for n in schema.get('args_param', []))
+ _create_param(s) for s in schema['params']
+ if s.get('positional', s.get('required', True)))
command['takes_options'] = tuple(
- params[n] for n in schema.get('options_param', []))
+ _create_param(s) for s in schema['params']
+ if not s.get('positional', s.get('required', True)))
command['has_output'] = tuple(
_create_output(m) for m in schema['output'])