mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
schema: remove no_cli from command schema
Instead, support excluding commands from specified contexts and exclude commands with NO_CLI set from the 'cli' context. https://fedorahosted.org/freeipa/ticket/4739 Reviewed-By: David Kupka <dkupka@redhat.com>
This commit is contained in:
4
VERSION
4
VERSION
@@ -90,5 +90,5 @@ IPA_DATA_VERSION=20100614120000
|
|||||||
# #
|
# #
|
||||||
########################################################
|
########################################################
|
||||||
IPA_API_VERSION_MAJOR=2
|
IPA_API_VERSION_MAJOR=2
|
||||||
IPA_API_VERSION_MINOR=192
|
IPA_API_VERSION_MINOR=193
|
||||||
# Last change: schema: remove redundant information
|
# Last change: schema: remove `no_cli` from command schema
|
||||||
|
|||||||
@@ -293,8 +293,8 @@ def _create_command(schema):
|
|||||||
command['obj_name'] = str(schema['obj_class'])
|
command['obj_name'] = str(schema['obj_class'])
|
||||||
if 'attr_name' in schema:
|
if 'attr_name' in schema:
|
||||||
command['attr_name'] = str(schema['attr_name'])
|
command['attr_name'] = str(schema['attr_name'])
|
||||||
if 'no_cli' in schema:
|
if 'exclude' in schema and u'cli' in schema['exclude']:
|
||||||
command['NO_CLI'] = schema['no_cli']
|
command['NO_CLI'] = True
|
||||||
command['takes_args'] = tuple(
|
command['takes_args'] = tuple(
|
||||||
_create_param(s) for s in schema['params']
|
_create_param(s) for s in schema['params']
|
||||||
if s.get('positional', s.get('required', True)))
|
if s.get('positional', s.get('required', True)))
|
||||||
|
|||||||
@@ -52,6 +52,16 @@ class BaseMetaObject(Object):
|
|||||||
label=_("Documentation"),
|
label=_("Documentation"),
|
||||||
flags={'no_search'},
|
flags={'no_search'},
|
||||||
),
|
),
|
||||||
|
Str(
|
||||||
|
'exclude*',
|
||||||
|
label=_("Exclude from"),
|
||||||
|
flags={'no_search'},
|
||||||
|
),
|
||||||
|
Str(
|
||||||
|
'include*',
|
||||||
|
label=_("Include in"),
|
||||||
|
flags={'no_search'},
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
def _get_obj(self, obj, **kwargs):
|
def _get_obj(self, obj, **kwargs):
|
||||||
@@ -176,11 +186,6 @@ class command(metaobject):
|
|||||||
label=_("Method name"),
|
label=_("Method name"),
|
||||||
flags={'no_search'},
|
flags={'no_search'},
|
||||||
),
|
),
|
||||||
Bool(
|
|
||||||
'no_cli?',
|
|
||||||
label=_("Exclude from CLI"),
|
|
||||||
flags={'no_search'},
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def _iter_params(self, cmd):
|
def _iter_params(self, cmd):
|
||||||
@@ -210,7 +215,7 @@ class command(metaobject):
|
|||||||
obj['attr_name'] = unicode(cmd.attr_name)
|
obj['attr_name'] = unicode(cmd.attr_name)
|
||||||
|
|
||||||
if cmd.NO_CLI:
|
if cmd.NO_CLI:
|
||||||
obj['no_cli'] = True
|
obj['exclude'] = [u'cli']
|
||||||
|
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
@@ -468,16 +473,6 @@ class param(BaseParam):
|
|||||||
label=_("Default from"),
|
label=_("Default from"),
|
||||||
flags={'no_search'},
|
flags={'no_search'},
|
||||||
),
|
),
|
||||||
Str(
|
|
||||||
'exclude*',
|
|
||||||
label=_("Exclude from"),
|
|
||||||
flags={'no_search'},
|
|
||||||
),
|
|
||||||
Str(
|
|
||||||
'include*',
|
|
||||||
label=_("Include in"),
|
|
||||||
flags={'no_search'},
|
|
||||||
),
|
|
||||||
Str(
|
Str(
|
||||||
'label?',
|
'label?',
|
||||||
label=_("Label"),
|
label=_("Label"),
|
||||||
|
|||||||
Reference in New Issue
Block a user