mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
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>
This commit is contained in:
@@ -542,23 +542,26 @@ class param(BaseParam):
|
||||
'include'):
|
||||
obj[key] = list(unicode(v) for v in value)
|
||||
if isinstance(metaobj, Command):
|
||||
if key in ('alwaysask',
|
||||
'confirm'):
|
||||
if key == 'alwaysask':
|
||||
obj.setdefault(key, value)
|
||||
elif key == 'confirm':
|
||||
obj[key] = value
|
||||
elif key in ('cli_metavar',
|
||||
'cli_name',
|
||||
'option_group'):
|
||||
obj[key] = unicode(value)
|
||||
elif key == 'default':
|
||||
if param.autofill:
|
||||
if param.multivalue:
|
||||
obj[key] = [unicode(v) for v in value]
|
||||
else:
|
||||
obj[key] = [unicode(value)]
|
||||
if param.multivalue:
|
||||
obj[key] = [unicode(v) for v in value]
|
||||
else:
|
||||
obj[key] = [unicode(value)]
|
||||
if not param.autofill:
|
||||
obj['alwaysask'] = True
|
||||
elif key == 'default_from':
|
||||
if param.autofill:
|
||||
obj['default_from_param'] = list(unicode(k)
|
||||
for k in value.keys)
|
||||
obj['default_from_param'] = list(unicode(k)
|
||||
for k in value.keys)
|
||||
if not param.autofill:
|
||||
obj['alwaysask'] = True
|
||||
elif key in ('exponential',
|
||||
'normalizer',
|
||||
'only_absolute',
|
||||
|
||||
Reference in New Issue
Block a user