diff options
author | Jan Cholasta <jcholast@redhat.com> | 2016-06-22 15:15:32 +0200 |
---|---|---|
committer | Jan Cholasta <jcholast@redhat.com> | 2016-06-27 16:42:42 +0200 |
commit | ac8e8ecdd3f75c104e30f68630290b0b1ad5a40b (patch) | |
tree | 861b0ec75029572cf367f82b1f97cc08861a8699 /ipaclient | |
parent | 7b8247a485081a6f1f5201e286ac17228f976355 (diff) | |
download | freeipa-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.py | 6 |
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: |