Exemple #1
0
 def get_service_plugin_by_path_prefix(cls, path_prefix):
     LOG.info('%s(): caller(): %s', log_utils.get_fname(1),
              log_utils.get_fname(2))
     service_plugins = directory.get_unique_plugins()
     for service_plugin in service_plugins:
         plugin_path_prefix = getattr(service_plugin, 'path_prefix', None)
         if plugin_path_prefix and plugin_path_prefix == path_prefix:
             return service_plugin
Exemple #2
0
def _get_plugins_workers():
    # NOTE(twilson) get_plugins also returns the core plugin
    plugins = directory.get_unique_plugins()

    # TODO(twilson) Instead of defaulting here, come up with a good way to
    # share a common get_workers default between NeutronPluginBaseV2 and
    # ServicePluginBase
    return [
        plugin_worker for plugin in plugins if hasattr(plugin, 'get_workers')
        for plugin_worker in plugin.get_workers()
    ]
Exemple #3
0
def _get_plugins_workers():
    # NOTE(twilson) get_plugins also returns the core plugin
    plugins = directory.get_unique_plugins()

    # TODO(twilson) Instead of defaulting here, come up with a good way to
    # share a common get_workers default between NeutronPluginBaseV2 and
    # ServicePluginBase
    return [
        plugin_worker
        for plugin in plugins if hasattr(plugin, 'get_workers')
        for plugin_worker in plugin.get_workers()
    ]
Exemple #4
0
 def test_get_unique_plugins(self):
     directory.add_plugin('foo1', fake_plugin)
     directory.add_plugin('foo2', fake_plugin)
     self.assertEqual(1, len(directory.get_unique_plugins()))
Exemple #5
0
 def test_get_unique_plugins_none(self):
     self.assertFalse(directory.get_unique_plugins())
Exemple #6
0
 def get_service_plugin_by_path_prefix(cls, path_prefix):
     service_plugins = directory.get_unique_plugins()
     for service_plugin in service_plugins:
         plugin_path_prefix = getattr(service_plugin, 'path_prefix', None)
         if plugin_path_prefix and plugin_path_prefix == path_prefix:
             return service_plugin
 def get_service_plugin_by_path_prefix(cls, path_prefix):
     service_plugins = directory.get_unique_plugins()
     for service_plugin in service_plugins:
         plugin_path_prefix = getattr(service_plugin, 'path_prefix', None)
         if plugin_path_prefix and plugin_path_prefix == path_prefix:
             return service_plugin