mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-23 23:50:03 -06:00
2cf7c7b4ac
Bundle remote plugin interface definitions for servers which lack API schema support. These server API versions are included: * 2.49: IPA 3.1.0 on RHEL/CentOS 6.5+, * 2.114: IPA 4.1.4 on Fedora 22, * 2.156: IPA 4.2.0 on RHEL/CentOS 7.2 and IPA 4.2.4 on Fedora 23, * 2.164: IPA 4.3.1 on Fedora 23. For servers with other API versions, the closest lower API version is used. https://fedorahosted.org/freeipa/ticket/4739 Reviewed-By: David Kupka <dkupka@redhat.com>
187 lines
4.6 KiB
Python
187 lines
4.6 KiB
Python
#
|
|
# Copyright (C) 2016 FreeIPA Contributors see COPYING for license
|
|
#
|
|
|
|
from ipalib.frontend import Command, Method
|
|
from ipalib.parameters import Str
|
|
from ipalib.text import _
|
|
|
|
|
|
class ClientCommand(Command):
|
|
def get_options(self):
|
|
skip = set()
|
|
for option in super(ClientCommand, self).get_options():
|
|
if option.name in skip:
|
|
continue
|
|
if option.name in ('all', 'raw'):
|
|
skip.add(option.name)
|
|
yield option
|
|
|
|
|
|
class ClientMethod(ClientCommand, Method):
|
|
_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(ClientMethod, 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
|
|
|
|
|
|
class CommandOverride(Command):
|
|
def __init__(self, api):
|
|
super(CommandOverride, self).__init__(api)
|
|
|
|
next_class = api.get_plugin_next(type(self))
|
|
self.next = next_class(api)
|
|
|
|
@property
|
|
def doc(self):
|
|
return self.next.doc
|
|
|
|
@property
|
|
def NO_CLI(self):
|
|
return self.next.NO_CLI
|
|
|
|
@property
|
|
def topic(self):
|
|
return self.next.topic
|
|
|
|
@property
|
|
def forwarded_name(self):
|
|
return self.next.forwarded_name
|
|
|
|
@property
|
|
def api_version(self):
|
|
return self.next.api_version
|
|
|
|
def _on_finalize(self):
|
|
self.next.finalize()
|
|
|
|
super(CommandOverride, self)._on_finalize()
|
|
|
|
def get_args(self):
|
|
for arg in self.next.args():
|
|
yield arg
|
|
for arg in super(CommandOverride, self).get_args():
|
|
yield arg
|
|
|
|
def get_options(self):
|
|
for option in self.next.options():
|
|
yield option
|
|
for option in super(CommandOverride, self).get_options():
|
|
if option.name not in ('all', 'raw', 'version'):
|
|
yield option
|
|
|
|
def get_output_params(self):
|
|
for output_param in self.next.output_params():
|
|
yield output_param
|
|
for output_param in super(CommandOverride, self).get_output_params():
|
|
yield output_param
|
|
|
|
def _iter_output(self):
|
|
return self.next.output()
|
|
|
|
|
|
class MethodOverride(CommandOverride, Method):
|
|
@property
|
|
def obj_name(self):
|
|
try:
|
|
return self.next.obj_name
|
|
except AttributeError:
|
|
return None
|
|
|
|
@property
|
|
def attr_name(self):
|
|
try:
|
|
return self.next.attr_name
|
|
except AttributeError:
|
|
return None
|
|
|
|
@property
|
|
def obj(self):
|
|
return self.next.obj
|
|
|
|
def get_output_params(self):
|
|
seen = set()
|
|
for output_param in super(MethodOverride, self).get_output_params():
|
|
if output_param.name in seen:
|
|
continue
|
|
seen.add(output_param.name)
|
|
yield output_param
|