Add missing parameter in call to _load_one_plugin

Stevedore 0.14 introduced a new paramter to the private method
ExtensionManager._load_one_plugin(). This broke our unit test suite, and
this patch adds that parameter to the call.

This patch supports both Stevedore < 0.14 and >= 0.14. Once we can pin
the version to >= 0.14, we should remove support for the old-style
call to _load_one_plugin.

For reference, we are directly calling this private method to provide a
mock-able extension manager and a corresponding fake extension for
testing the Conductor and the various extensions it loads.

Change-Id: Ib51f841af00548c3e20128f44a4b7a48422c1aa9
Closes-bug: #1273472
This commit is contained in:
Devananda van der Veen 2014-01-27 15:00:14 -08:00
parent 5983ad8523
commit 087a8ea666
1 changed files with 8 additions and 1 deletions

View File

@ -50,7 +50,14 @@ def get_mockable_extension_manager(driver, namespace):
dispatch.NameDispatchExtensionManager('ironic.no-such-namespace',
lambda x: True)
mock_ext_mgr = driver_factory.DriverFactory()
mock_ext = mock_ext_mgr._extension_manager._load_one_plugin(
try:
mock_ext = mock_ext_mgr._extension_manager._load_one_plugin(
entry_point, True, [], {},
False)
except TypeError:
# TODO(deva): remove this after I7f4cec7071 lands and stevedore is
# pinned >= 0.14 in requirements.txt
mock_ext = mock_ext_mgr._extension_manager._load_one_plugin(
entry_point, True, [], {})
mock_ext_mgr._extension_manager.extensions = [mock_ext]
mock_ext_mgr._extension_manager.by_name = dict((e.name, e)