summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Cholasta <jcholast@redhat.com>2016-06-16 13:21:57 +0200
committerJan Cholasta <jcholast@redhat.com>2016-06-20 16:39:12 +0200
commit91faf3ecd7708409350c8c5961833cbde202b2b2 (patch)
tree14a9284589bf4ff908a936d367a0371369405123
parentec1b3e71b2688eed2264b7b24d9e8fcff938967f (diff)
downloadfreeipa-91faf3ecd7708409350c8c5961833cbde202b2b2.tar.gz
freeipa-91faf3ecd7708409350c8c5961833cbde202b2b2.tar.xz
freeipa-91faf3ecd7708409350c8c5961833cbde202b2b2.zip
schema: remove output_params
Since output params are copied from object plugins, remove them from command schema and include object name instead. One exception to this are the output params used for failed members in member add/remove commands. Move these to the client side, as they will be replaced by warnings. https://fedorahosted.org/freeipa/ticket/4739 Reviewed-By: David Kupka <dkupka@redhat.com>
-rw-r--r--VERSION4
-rw-r--r--ipaclient/plugins/automember.py35
-rw-r--r--ipaclient/remote_plugins/schema.py100
-rw-r--r--ipaserver/plugins/schema.py23
4 files changed, 146 insertions, 16 deletions
diff --git a/VERSION b/VERSION
index a603cbeb3..24bad7ff7 100644
--- a/VERSION
+++ b/VERSION
@@ -90,5 +90,5 @@ IPA_DATA_VERSION=20100614120000
# #
########################################################
IPA_API_VERSION_MAJOR=2
-IPA_API_VERSION_MINOR=189
-# Last change: schema: add object class schema
+IPA_API_VERSION_MINOR=190
+# Last change: schema: remove output_params
diff --git a/ipaclient/plugins/automember.py b/ipaclient/plugins/automember.py
new file mode 100644
index 000000000..98caf931d
--- /dev/null
+++ b/ipaclient/plugins/automember.py
@@ -0,0 +1,35 @@
+# Authors:
+# Jr Aquino <jr.aquino@citrix.com>
+#
+# Copyright (C) 2011 Red Hat
+# see file 'COPYING' for use and warranty information
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+from ipaclient.frontend import MethodOverride
+from ipalib.frontend import Str
+from ipalib.plugable import Registry
+from ipalib.text import _
+
+register = Registry()
+
+
+@register(override=True)
+class automember_add_condition(MethodOverride):
+ has_output_params = (
+ Str('failed',
+ label=_('Failed to add'),
+ flags=['suppress_empty'],
+ ),
+ )
diff --git a/ipaclient/remote_plugins/schema.py b/ipaclient/remote_plugins/schema.py
index d026d44a4..0ad2d25c6 100644
--- a/ipaclient/remote_plugins/schema.py
+++ b/ipaclient/remote_plugins/schema.py
@@ -11,10 +11,10 @@ import six
from ipaclient.plugins.rpcclient import rpcclient
from ipalib import parameters, plugable
-from ipalib.frontend import Command, Object
+from ipalib.frontend import Command, Method, Object
from ipalib.output import Output
from ipalib.parameters import Bool, DefaultFrom, Flag, Password, Str
-from ipalib.text import ConcatenatedLazyText
+from ipalib.text import ConcatenatedLazyText, _
from ipapython.dn import DN
from ipapython.dnsutil import DNSName
@@ -97,6 +97,91 @@ class _SchemaCommand(Command):
yield option
+class _SchemaMethod(Method, _SchemaCommand):
+ _failed_member_output_params = (
+ # baseldap
+ Str(
+ 'member',
+ label=_("Failed members"),
+ ),
+ Str(
+ 'sourcehost',
+ label=_("Failed source hosts/hostgroups"),
+ ),
+ Str(
+ 'memberhost',
+ label=_("Failed hosts/hostgroups"),
+ ),
+ Str(
+ 'memberuser',
+ label=_("Failed users/groups"),
+ ),
+ Str(
+ 'memberservice',
+ label=_("Failed service/service groups"),
+ ),
+ Str(
+ 'failed',
+ label=_("Failed to remove"),
+ flags=['suppress_empty'],
+ ),
+ Str(
+ 'ipasudorunas',
+ label=_("Failed RunAs"),
+ ),
+ Str(
+ 'ipasudorunasgroup',
+ label=_("Failed RunAsGroup"),
+ ),
+ # caacl
+ Str(
+ 'ipamembercertprofile',
+ label=_("Failed profiles"),
+ ),
+ Str(
+ 'ipamemberca',
+ label=_("Failed CAs"),
+ ),
+ # host
+ Str(
+ 'managedby',
+ label=_("Failed managedby"),
+ ),
+ # service
+ Str(
+ 'ipaallowedtoperform_read_keys',
+ label=_("Failed allowed to retrieve keytab"),
+ ),
+ Str(
+ 'ipaallowedtoperform_write_keys',
+ label=_("Failed allowed to create keytab"),
+ ),
+ # servicedelegation
+ Str(
+ 'failed_memberprincipal',
+ label=_("Failed members"),
+ ),
+ Str(
+ 'ipaallowedtarget',
+ label=_("Failed targets"),
+ ),
+ # vault
+ Str(
+ 'owner?',
+ label=_("Failed owners"),
+ ),
+ )
+
+ def get_output_params(self):
+ seen = set()
+ for output_param in super(_SchemaMethod, self).get_output_params():
+ seen.add(output_param.name)
+ yield output_param
+ for output_param in self._failed_member_output_params:
+ if output_param.name not in seen:
+ yield output_param
+
+
def _nope():
pass
@@ -212,14 +297,16 @@ def _create_command(schema):
command['topic'] = str(schema['topic_topic'])
else:
command['topic'] = None
+ if 'obj_class' in schema:
+ command['obj_name'] = str(schema['obj_class'])
+ if 'attr_name' in schema:
+ command['attr_name'] = str(schema['attr_name'])
if 'no_cli' in schema:
command['NO_CLI'] = schema['no_cli']
command['takes_args'] = tuple(
params[n] for n in schema.get('args_param', []))
command['takes_options'] = tuple(
params[n] for n in schema.get('options_param', []))
- command['has_output_params'] = tuple(
- params[n] for n in schema.get('output_params_param', []))
command['has_output'] = tuple(
_create_output(m) for m in schema['output'])
@@ -254,7 +341,10 @@ class _LazySchemaPlugin(object):
@property
def bases(self):
if self.__base is Command:
- return (_SchemaCommand,)
+ if 'obj_class' in self.__schema:
+ return (_SchemaMethod,)
+ else:
+ return (_SchemaCommand,)
else:
return (self.__base,)
diff --git a/ipaserver/plugins/schema.py b/ipaserver/plugins/schema.py
index ca662a686..32803a053 100644
--- a/ipaserver/plugins/schema.py
+++ b/ipaserver/plugins/schema.py
@@ -167,6 +167,16 @@ class metaobject_find(MetaSearch):
class command(metaobject):
takes_params = metaobject.takes_params + (
Str(
+ 'obj_class?',
+ label=_("Method of"),
+ flags={'no_search'},
+ ),
+ Str(
+ 'attr_name?',
+ label=_("Method name"),
+ flags={'no_search'},
+ ),
+ Str(
'args_param*',
label=_("Arguments"),
flags={'no_search'},
@@ -176,11 +186,6 @@ class command(metaobject):
label=_("Options"),
flags={'no_search'},
),
- Str(
- 'output_params_param*',
- label=_("Output parameters"),
- flags={'no_search'},
- ),
Bool(
'no_cli?',
label=_("Exclude from CLI"),
@@ -210,6 +215,10 @@ class command(metaobject):
else:
obj['topic_topic'] = topic['name']
+ if isinstance(cmd, Method):
+ obj['obj_class'] = unicode(cmd.obj_name)
+ obj['attr_name'] = unicode(cmd.attr_name)
+
if cmd.NO_CLI:
obj['no_cli'] = True
@@ -220,10 +229,6 @@ class command(metaobject):
obj['options_param'] = tuple(
unicode(n) for n in cmd.options if n != 'version')
- if len(cmd.output_params):
- obj['output_params_param'] = tuple(
- unicode(n) for n in cmd.output_params)
-
return obj
def _retrieve(self, name, **kwargs):