summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ipalib/plugable.py13
-rw-r--r--tests/test_ipalib/test_plugable.py13
2 files changed, 26 insertions, 0 deletions
diff --git a/ipalib/plugable.py b/ipalib/plugable.py
index f0121433..4c0b175f 100644
--- a/ipalib/plugable.py
+++ b/ipalib/plugable.py
@@ -735,9 +735,22 @@ class API(DictProxy):
"""
self.__doing('bootstrap')
+ def load_plugins(self, dry_run=False):
+ """
+ Load plugins from all standard locations.
+
+ `API.bootstrap` will automatically be called if it hasn't been
+ already.
+ """
+ self.__doing('load_plugins')
+ self.__do_if_not_done('bootstrap')
+
def finalize(self):
"""
Finalize the registration, instantiate the plugins.
+
+ `API.bootstrap` will automatically be called if it hasn't been
+ already.
"""
self.__doing('finalize')
self.__do_if_not_done('bootstrap')
diff --git a/tests/test_ipalib/test_plugable.py b/tests/test_ipalib/test_plugable.py
index bdbadae5..ba98e752 100644
--- a/tests/test_ipalib/test_plugable.py
+++ b/tests/test_ipalib/test_plugable.py
@@ -883,3 +883,16 @@ class test_API(ClassChecker):
assert o.isdone('bootstrap') is True
e = raises(StandardError, o.bootstrap)
assert str(e) == 'API.bootstrap() already called'
+
+ def test_load_plugins(self):
+ """
+ Test the `ipalib.plugable.API.load_plugins` method.
+ """
+ o = self.cls()
+ assert o.isdone('bootstrap') is False
+ assert o.isdone('load_plugins') is False
+ o.load_plugins(dry_run=True)
+ assert o.isdone('bootstrap') is True
+ assert o.isdone('load_plugins') is True
+ e = raises(StandardError, o.load_plugins)
+ assert str(e) == 'API.load_plugins() already called'