mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
misc: generate plugins
result directly in the command
Move the code that generated result of the `plugins` command from API to the command itself. https://fedorahosted.org/freeipa/ticket/4427 Reviewed-By: David Kupka <dkupka@redhat.com>
This commit is contained in:
parent
22f26cfa8e
commit
9a21964877
@ -671,7 +671,6 @@ class API(ReadOnly):
|
||||
self.__do_if_not_done('load_plugins')
|
||||
|
||||
production_mode = self.is_production_mode()
|
||||
plugin_info = {}
|
||||
|
||||
for base in self.bases:
|
||||
name = base.__name__
|
||||
@ -679,9 +678,6 @@ class API(ReadOnly):
|
||||
for klass in six.itervalues(self.__plugins):
|
||||
if not any(issubclass(b, base) for b in klass.bases):
|
||||
continue
|
||||
plugin_info.setdefault(
|
||||
'%s.%s' % (klass.__module__, klass.name),
|
||||
[]).append(name)
|
||||
if not self.env.plugins_on_demand:
|
||||
self._get(klass.name)
|
||||
|
||||
@ -698,7 +694,6 @@ class API(ReadOnly):
|
||||
assert islocked(instance)
|
||||
|
||||
self.__finalized = True
|
||||
self.plugins = tuple((k, tuple(v)) for k, v in plugin_info.items())
|
||||
|
||||
if not production_mode:
|
||||
lock(self)
|
||||
|
@ -133,6 +133,13 @@ class plugins(LocalOrRemote):
|
||||
)
|
||||
|
||||
def execute(self, **options):
|
||||
result = {}
|
||||
for namespace in self.api:
|
||||
for plugin in self.api[namespace]():
|
||||
cls = type(plugin)
|
||||
key = '{}.{}'.format(cls.__module__, cls.__name__)
|
||||
result.setdefault(key, []).append(namespace)
|
||||
|
||||
return dict(
|
||||
result=dict(self.api.plugins),
|
||||
result=result,
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user