summaryrefslogtreecommitdiffstats
path: root/ipaserver/plugins/schema.py
diff options
context:
space:
mode:
authorJan Cholasta <jcholast@redhat.com>2016-06-08 16:24:45 +0200
committerJan Cholasta <jcholast@redhat.com>2016-06-20 16:39:12 +0200
commitcbe73c6d2816d590d4314c6d4207de2cfc7d274e (patch)
tree3b8e6cee0be5aa8f68a057cdf0e75c7ed3239c36 /ipaserver/plugins/schema.py
parentd0cfe37a7ebda848abd32fc46129e7844da5a9be (diff)
downloadfreeipa-cbe73c6d2816d590d4314c6d4207de2cfc7d274e.tar.gz
freeipa-cbe73c6d2816d590d4314c6d4207de2cfc7d274e.tar.xz
freeipa-cbe73c6d2816d590d4314c6d4207de2cfc7d274e.zip
schema: remove redundant information
Remove the `autofill` kwarg from param schema. On the server, include default value only if autofill is set. On the client, set autofill if param has a default value. Remove the `deprecated_cli_aliases`, `hint` and `sortorder` kwargs, and the `dnsrecord_extra`, `dnsrecord_part` and `suppress_empty` flags from param schema, as they are now handled exclusively on the client. Replace the `no_option` and `no_output` flags in param schema with exclusion of the param in 'cli' and 'webui' contexts. Remove the `no_display` flag from output schema, as it is now handled exclusively on the client. https://fedorahosted.org/freeipa/ticket/4739 Reviewed-By: David Kupka <dkupka@redhat.com>
Diffstat (limited to 'ipaserver/plugins/schema.py')
-rw-r--r--ipaserver/plugins/schema.py96
1 files changed, 17 insertions, 79 deletions
diff --git a/ipaserver/plugins/schema.py b/ipaserver/plugins/schema.py
index 42806e775..021646390 100644
--- a/ipaserver/plugins/schema.py
+++ b/ipaserver/plugins/schema.py
@@ -13,7 +13,7 @@ from ipalib import errors
from ipalib.crud import PKQuery, Retrieve, Search
from ipalib.frontend import Command, Local, Method, Object
from ipalib.output import Entry, ListOfEntries, ListOfPrimaryKeys, PrimaryKey
-from ipalib.parameters import Bool, Dict, Flag, Int, Str
+from ipalib.parameters import Bool, Dict, Flag, Str
from ipalib.plugable import Registry
from ipalib.text import _
from ipapython.version import API_VERSION
@@ -443,11 +443,6 @@ class param(BaseParam):
label=_("Always ask"),
flags={'no_search'},
),
- Bool(
- 'autofill?',
- label=_("Autofill"),
- flags={'no_search'},
- ),
Str(
'cli_metavar?',
label=_("CLI metavar"),
@@ -474,21 +469,11 @@ class param(BaseParam):
flags={'no_search'},
),
Str(
- 'deprecated_cli_aliases*',
- label=_("Deprecated CLI aliases"),
- flags={'no_search'},
- ),
- Str(
'exclude*',
label=_("Exclude from"),
flags={'no_search'},
),
Str(
- 'hint?',
- label=_("Hint"),
- flags={'no_search'},
- ),
- Str(
'include*',
label=_("Include in"),
flags={'no_search'},
@@ -508,36 +493,6 @@ class param(BaseParam):
label=_("Option group"),
flags={'no_search'},
),
- Int(
- 'sortorder?',
- label=_("Sort order"),
- flags={'no_search'},
- ),
- Bool(
- 'dnsrecord_extra?',
- label=_("Extra field (DNS record)"),
- flags={'no_search'},
- ),
- Bool(
- 'dnsrecord_part?',
- label=_("Part (DNS record)"),
- flags={'no_search'},
- ),
- Bool(
- 'no_option?',
- label=_("No option"),
- flags={'no_search'},
- ),
- Bool(
- 'no_output?',
- label=_("No output"),
- flags={'no_search'},
- ),
- Bool(
- 'suppress_empty?',
- label=_("Suppress empty"),
- flags={'no_search'},
- ),
Bool(
'sensitive?',
label=_("Sensitive"),
@@ -588,40 +543,35 @@ class param(BaseParam):
obj[key] = list(unicode(v) for v in value)
if isinstance(metaobj, Command):
if key in ('alwaysask',
- 'autofill',
- 'confirm',
- 'sortorder'):
+ 'confirm'):
obj[key] = value
elif key in ('cli_metavar',
'cli_name',
- 'hint',
'option_group'):
obj[key] = unicode(value)
elif key == 'default':
- if param.multivalue:
- obj[key] = [unicode(v) for v in value]
- else:
- obj[key] = [unicode(value)]
+ if param.autofill:
+ if param.multivalue:
+ obj[key] = [unicode(v) for v in value]
+ else:
+ obj[key] = [unicode(value)]
elif key == 'default_from':
- obj['default_from_param'] = list(unicode(k)
- for k in value.keys)
- elif key == 'deprecated_cli_aliases':
- obj[key] = list(unicode(v) for v in value)
+ if param.autofill:
+ obj['default_from_param'] = list(unicode(k)
+ for k in value.keys)
elif key in ('exponential',
'normalizer',
'only_absolute',
'precision'):
obj['no_convert'] = True
- for flag in (param.flags or []):
- if flag in ('no_output',
- 'suppress_empty'):
- obj[flag] = True
- if isinstance(metaobj, Command):
- if flag in ('dnsrecord_extra',
- 'dnsrecord_part',
- 'no_option'):
- obj[flag] = True
+ if ((isinstance(metaobj, Command) and 'no_option' in param.flags) or
+ (isinstance(metaobj, Object) and 'no_output' in param.flags)):
+ value = obj.setdefault('exclude', [])
+ if u'cli' not in value:
+ value.append(u'cli')
+ if u'webui' not in value:
+ value.append(u'webui')
return obj
@@ -666,14 +616,6 @@ class param_find(BaseParamSearch):
@register()
class output(BaseParam):
- takes_params = BaseParam.takes_params + (
- Bool(
- 'no_display?',
- label=_("Do not display"),
- flags={'no_search'},
- ),
- )
-
@property
def parent(self):
return self.api.Object.command
@@ -721,10 +663,6 @@ class output(BaseParam):
if 'doc' in output.__dict__:
obj['doc'] = unicode(output.doc)
- if 'flags' in output.__dict__:
- if 'no_display' in output.flags:
- obj['no_display'] = True
-
return obj
def _retrieve(self, commandname, name, **kwargs):