From 93a6a5822d741d78e23b41473cb22605cc53a2b2 Mon Sep 17 00:00:00 2001 From: Nikita Konovalov Date: Wed, 10 Jun 2015 14:27:47 +0300 Subject: [PATCH] Removed unused filtering in get_plugins Filtering by base class for plugins was never required. The unused imports removed as well. This is one of the initial refactoring steps for sahara and plugins into different projects. Partially-implements bp: move-plugins-to-separate-repo Change-Id: I20e83fd432b95c6e86ae218fa1a8e13766e8a461 --- sahara/plugins/base.py | 7 ++----- sahara/service/api.py | 4 +--- sahara/service/edp/api.py | 4 +--- sahara/tests/unit/plugins/test_base_plugins_support.py | 2 +- 4 files changed, 5 insertions(+), 12 deletions(-) diff --git a/sahara/plugins/base.py b/sahara/plugins/base.py index 186c9a61..4db0d770 100644 --- a/sahara/plugins/base.py +++ b/sahara/plugins/base.py @@ -114,11 +114,8 @@ class PluginManager(object): _("Plugins couldn't be loaded: %s") % ", ".join(requested_plugins - loaded_plugins)) - def get_plugins(self, base): - return [ - self.plugins[plugin] for plugin in CONF.plugins - if not base or issubclass(self.plugins[plugin].__class__, base) - ] + def get_plugins(self): + return [self.plugins[plugin] for plugin in CONF.plugins] def get_plugin(self, plugin_name): return self.plugins.get(plugin_name) diff --git a/sahara/service/api.py b/sahara/service/api.py index 77841bee..8dc14c64 100644 --- a/sahara/service/api.py +++ b/sahara/service/api.py @@ -22,7 +22,6 @@ from six.moves.urllib import parse as urlparse from sahara import conductor as c from sahara import context from sahara.plugins import base as plugin_base -from sahara.plugins import provisioning from sahara.service import quotas from sahara.utils import general as g from sahara.utils.notification import sender @@ -182,8 +181,7 @@ def update_node_group_template(id, values): # Plugins ops def get_plugins(): - return plugin_base.PLUGINS.get_plugins( - base=provisioning.ProvisioningPluginBase) + return plugin_base.PLUGINS.get_plugins() def get_plugin(plugin_name, version=None): diff --git a/sahara/service/edp/api.py b/sahara/service/edp/api.py index 7f0e89fb..06cf8c65 100644 --- a/sahara/service/edp/api.py +++ b/sahara/service/edp/api.py @@ -22,7 +22,6 @@ from sahara import context from sahara import exceptions as ex from sahara.i18n import _LE from sahara.plugins import base as plugin_base -from sahara.plugins import provisioning from sahara.service.edp.binary_retrievers import dispatch from sahara.service.edp import job_manager as manager from sahara.utils import edp @@ -54,8 +53,7 @@ def get_job_types(**kwargs): hints = kwargs.get("hints", ["false"])[0].lower() == "true" plugin_names = kwargs.get("plugin", []) - all_plugins = plugin_base.PLUGINS.get_plugins( - base=provisioning.ProvisioningPluginBase) + all_plugins = plugin_base.PLUGINS.get_plugins() if plugin_names: plugins = filter(lambda x: x.name in plugin_names, all_plugins) else: diff --git a/sahara/tests/unit/plugins/test_base_plugins_support.py b/sahara/tests/unit/plugins/test_base_plugins_support.py index 75fcbb19..5e106a93 100644 --- a/sahara/tests/unit/plugins/test_base_plugins_support.py +++ b/sahara/tests/unit/plugins/test_base_plugins_support.py @@ -25,6 +25,6 @@ class BasePluginsSupportTest(testtools.TestCase): pb.setup_plugins() def test_plugins_loaded(self): - plugins = [p.name for p in pb.PLUGINS.get_plugins(pb.PluginInterface)] + plugins = [p.name for p in pb.PLUGINS.get_plugins()] self.assertIn('vanilla', plugins) self.assertIn('hdp', plugins)