summaryrefslogtreecommitdiffstats
path: root/ipaserver
diff options
context:
space:
mode:
authorJan Cholasta <jcholast@redhat.com>2016-06-14 13:37:23 +0200
committerJan Cholasta <jcholast@redhat.com>2016-06-15 14:03:51 +0200
commita64aba36a42397b02b4032dcd7e7cfa84ae6d30f (patch)
tree96bbf8d0fcd3f0b1c7b822f837b2271bb91453b1 /ipaserver
parentf7240c6df8bb6f3188faaf518031f9f0fbf89f5c (diff)
downloadfreeipa-a64aba36a42397b02b4032dcd7e7cfa84ae6d30f.tar.gz
freeipa-a64aba36a42397b02b4032dcd7e7cfa84ae6d30f.tar.xz
freeipa-a64aba36a42397b02b4032dcd7e7cfa84ae6d30f.zip
schema: exclude local commands
Commands inherited from Local can't be executed remotely, so exclude them from API schema. https://fedorahosted.org/freeipa/ticket/4739 Reviewed-By: David Kupka <dkupka@redhat.com>
Diffstat (limited to 'ipaserver')
-rw-r--r--ipaserver/plugins/schema.py22
1 files changed, 14 insertions, 8 deletions
diff --git a/ipaserver/plugins/schema.py b/ipaserver/plugins/schema.py
index ae233d205..e5aac6ff9 100644
--- a/ipaserver/plugins/schema.py
+++ b/ipaserver/plugins/schema.py
@@ -10,7 +10,7 @@ import six
from ipalib import errors
from ipalib.crud import PKQuery, Retrieve, Search
-from ipalib.frontend import Command, Method, Object
+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.plugable import Registry
@@ -188,16 +188,22 @@ class command(MetaObject):
def _retrieve(self, name, **kwargs):
try:
- return self.api.Command[name]
+ command = self.api.Command[name]
+ if not isinstance(command, Local):
+ return command
except KeyError:
- raise errors.NotFound(
- reason=_("%(pkey)s: %(oname)s not found") % {
- 'pkey': name, 'oname': self.name,
- }
- )
+ pass
+
+ raise errors.NotFound(
+ reason=_("%(pkey)s: %(oname)s not found") % {
+ 'pkey': name, 'oname': self.name,
+ }
+ )
def _search(self, **kwargs):
- return self.api.Command()
+ for command in self.api.Command():
+ if not isinstance(command, Local):
+ yield command
@register()