Use names() method of ExtensionManager insted of keys()
There is no keys() method for ExtensionManager. The names() method [1] must be used. [1] http://docs.openstack.org/developer/stevedore/managers.html#stevedore.extension.ExtensionManager.names Change-Id: I4177d076733abe6b855d8fbf1c2633097de1fe84
This commit is contained in:
parent
678c34e287
commit
c32d2a6e67
@ -37,7 +37,7 @@ def initialize(reset=False):
|
||||
if reset or (_EXT_MANAGER is None):
|
||||
_EXT_MANAGER = extension.ExtensionManager(namespace='os_vif',
|
||||
invoke_on_load=False)
|
||||
for plugin_name in _EXT_MANAGER.keys():
|
||||
for plugin_name in _EXT_MANAGER.names():
|
||||
cls = _EXT_MANAGER[plugin_name].plugin
|
||||
obj = cls.load(plugin_name)
|
||||
_EXT_MANAGER[plugin_name].obj = obj
|
||||
|
@ -103,8 +103,10 @@ class TestOSVIF(base.TestCase):
|
||||
entry_point="os-vif",
|
||||
plugin=DemoPlugin,
|
||||
obj=None)
|
||||
with mock.patch('stevedore.extension.ExtensionManager',
|
||||
return_value={'foobar': plg}):
|
||||
with mock.patch('stevedore.extension.ExtensionManager.names',
|
||||
return_value=['foobar']),\
|
||||
mock.patch('stevedore.extension.ExtensionManager.__getitem__',
|
||||
return_value=plg):
|
||||
os_vif.initialize()
|
||||
info = objects.instance_info.InstanceInfo()
|
||||
vif = objects.vif.VIFBridge(id='uniq',
|
||||
@ -118,8 +120,10 @@ class TestOSVIF(base.TestCase):
|
||||
entry_point="os-vif",
|
||||
plugin=DemoPlugin,
|
||||
obj=None)
|
||||
with mock.patch('stevedore.extension.ExtensionManager',
|
||||
return_value={'foobar': plg}):
|
||||
with mock.patch('stevedore.extension.ExtensionManager.names',
|
||||
return_value=['foobar']),\
|
||||
mock.patch('stevedore.extension.ExtensionManager.__getitem__',
|
||||
return_value=plg):
|
||||
os_vif.initialize()
|
||||
info = objects.instance_info.InstanceInfo()
|
||||
vif = objects.vif.VIFBridge(id='uniq',
|
||||
|
Loading…
Reference in New Issue
Block a user