summaryrefslogtreecommitdiffstats
path: root/ipaclient
diff options
context:
space:
mode:
authorJan Cholasta <jcholast@redhat.com>2016-06-22 15:15:32 +0200
committerJan Cholasta <jcholast@redhat.com>2016-06-27 16:42:42 +0200
commitac8e8ecdd3f75c104e30f68630290b0b1ad5a40b (patch)
tree861b0ec75029572cf367f82b1f97cc08861a8699 /ipaclient
parent7b8247a485081a6f1f5201e286ac17228f976355 (diff)
downloadfreeipa-ac8e8ecdd3f75c104e30f68630290b0b1ad5a40b.tar.gz
freeipa-ac8e8ecdd3f75c104e30f68630290b0b1ad5a40b.tar.xz
freeipa-ac8e8ecdd3f75c104e30f68630290b0b1ad5a40b.zip
schema: fix param default value handling
Advertise param's default value even when `autofill` is False. When `autofill` is False, set `alwaysask` to True in the schema, as it is semantically equivallent and removes redundancy. This fixes default value disappearing in CLI for some params. https://fedorahosted.org/freeipa/ticket/4739 Reviewed-By: David Kupka <dkupka@redhat.com>
Diffstat (limited to 'ipaclient')
-rw-r--r--ipaclient/remote_plugins/schema.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/ipaclient/remote_plugins/schema.py b/ipaclient/remote_plugins/schema.py
index c21da5ff0..b944fb08f 100644
--- a/ipaclient/remote_plugins/schema.py
+++ b/ipaclient/remote_plugins/schema.py
@@ -213,7 +213,6 @@ def _create_param(meta):
for key, value in meta.items():
if key in ('alwaysask',
- 'autofill',
'doc',
'label',
'multivalue',
@@ -229,11 +228,9 @@ def _create_param(meta):
kwargs[key] = value
elif key == 'default':
default = value
- kwargs['autofill'] = True
elif key == 'default_from_param':
kwargs['default_from'] = DefaultFrom(_nope,
*(str(k) for k in value))
- kwargs['autofill'] = True
elif key in ('exclude',
'include'):
kwargs[key] = tuple(str(v) for v in value)
@@ -246,6 +243,9 @@ def _create_param(meta):
default = tmp._convert_scalar(default[0])
kwargs['default'] = default
+ if 'default' in kwargs or 'default_from' in kwargs:
+ kwargs['autofill'] = not kwargs.pop('alwaysask', False)
+
param = cls(str(meta['name']), **kwargs)
if sensitive: