schema plugin: Fix commands without metaobject arg

Previously, all the commands of schema plugin derived from
BaseMetaSearch require metaobject as their argument
(by implementation), but the spec for some of them only optionally
asks for search criteria arg. This patch fixes this inconsistency.

Fixes: https://pagure.io/freeipa/issue/8954
Signed-off-by: Stanislav Levin <slev@altlinux.org>
Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
This commit is contained in:
Stanislav Levin 2021-08-13 14:29:55 +03:00 committed by Florence Blanc-Renaud
parent 540b01bc6e
commit 7706dfaf09

View File

@ -129,8 +129,8 @@ class BaseMetaSearch(Search):
"(\"%s\")") % 'name',
)
def execute(self, command, criteria=None, **options):
result = list(self.obj.search(command, criteria, **options))
def execute(self, criteria=None, **options):
result = list(self.obj.search(criteria, **options))
return dict(result=result, count=len(result), truncated=False)
@ -494,7 +494,9 @@ class BaseParamRetrieve(BaseParamMethod, BaseMetaRetrieve):
class BaseParamSearch(BaseParamMethod, BaseMetaSearch):
pass
def execute(self, command, criteria=None, **options):
result = list(self.obj.search(command, criteria, **options))
return dict(result=result, count=len(result), truncated=False)
@register()