mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2026-07-29 15:55:47 -05:00
ipalib: Allow multiple API instances
Merged the Registrar class into the Registry class. Plugins are now registered globally instead of in ipalib.api and are instantiated per-API instance. Different set of plugin base classes can be used in each API instance. https://fedorahosted.org/freeipa/ticket/3090 Reviewed-By: Tomas Babej <tbabej@redhat.com>
This commit is contained in:
committed by
Tomas Babej
parent
aa745b31d3
commit
2db741e847
+9
-1
@@ -27,7 +27,7 @@ from distutils import version
|
||||
from ipapython.version import API_VERSION
|
||||
from ipapython.ipa_log_manager import root_logger
|
||||
from base import NameSpace
|
||||
from plugable import Plugin, is_production_mode
|
||||
from plugable import Plugin, Registry, is_production_mode
|
||||
from parameters import create_param, Param, Str, Flag, Password
|
||||
from output import Output, Entry, ListOfEntries
|
||||
from text import _
|
||||
@@ -40,6 +40,9 @@ from textwrap import wrap
|
||||
|
||||
RULE_FLAG = 'validation_rule'
|
||||
|
||||
register = Registry()
|
||||
|
||||
|
||||
def rule(obj):
|
||||
assert not hasattr(obj, RULE_FLAG)
|
||||
setattr(obj, RULE_FLAG, True)
|
||||
@@ -366,6 +369,7 @@ class HasParam(Plugin):
|
||||
setattr(self, name, namespace)
|
||||
|
||||
|
||||
@register.base()
|
||||
class Command(HasParam):
|
||||
"""
|
||||
A public IPA atomic operation.
|
||||
@@ -1120,6 +1124,7 @@ class Local(Command):
|
||||
return self.forward(*args, **options)
|
||||
|
||||
|
||||
@register.base()
|
||||
class Object(HasParam):
|
||||
finalize_early = False
|
||||
|
||||
@@ -1278,6 +1283,7 @@ class Attribute(Plugin):
|
||||
super(Attribute, self)._on_finalize()
|
||||
|
||||
|
||||
@register.base()
|
||||
class Method(Attribute, Command):
|
||||
"""
|
||||
A command with an associated object.
|
||||
@@ -1364,6 +1370,7 @@ class Method(Attribute, Command):
|
||||
yield param
|
||||
|
||||
|
||||
@register.base()
|
||||
class Updater(Method):
|
||||
"""
|
||||
An LDAP update with an associated object (always update).
|
||||
@@ -1423,6 +1430,7 @@ class _AdviceOutput(object):
|
||||
self.content.append(line)
|
||||
|
||||
|
||||
@register.base()
|
||||
class Advice(Plugin):
|
||||
"""
|
||||
Base class for advices, plugins for ipa-advise.
|
||||
|
||||
Reference in New Issue
Block a user