diff --git a/etc/vitrage/vitrage.conf.sample b/etc/vitrage/vitrage.conf.sample index d0301f8c3..f8228bf8f 100644 --- a/etc/vitrage/vitrage.conf.sample +++ b/etc/vitrage/vitrage.conf.sample @@ -551,7 +551,7 @@ #snapshots_interval = 600 -[synchronizer_plugins] +[plugins] # # From vitrage diff --git a/vitrage/entity_graph/processor/processor.py b/vitrage/entity_graph/processor/processor.py index 50618ac06..8d759715a 100644 --- a/vitrage/entity_graph/processor/processor.py +++ b/vitrage/entity_graph/processor/processor.py @@ -154,8 +154,9 @@ class Processor(processor.ProcessorBase): def handle_end_message(self, vertex, neighbors): self.initialization_status.end_messages[vertex[VProps.TYPE]] = True + if len(self.initialization_status.end_messages) == \ - len(self.conf.synchronizer_plugins.plugin_type): + len(self.conf.plugins.plugin_type): self.initialization_status.status = \ self.initialization_status.RECEIVED_ALL_END_MESSAGES diff --git a/vitrage/entity_graph/states/state_manager.py b/vitrage/entity_graph/states/state_manager.py index f5b6ab543..4e8f7601e 100644 --- a/vitrage/entity_graph/states/state_manager.py +++ b/vitrage/entity_graph/states/state_manager.py @@ -208,12 +208,12 @@ class StateManager(object): not attr.startswith("__")] def _is_all_plugins_states_exists(self, states_plugins, error_plugins): - plugins = self.conf.synchronizer_plugins.plugin_type + plugin_types = self.conf.plugins.plugin_type all_state_loaded_plugins = states_plugins + error_plugins - for plugin in plugins: - if plugin not in all_state_loaded_plugins: - LOG.error("No state configuration file for: %s", plugin) + for plugin_type in plugin_types: + if plugin_type not in all_state_loaded_plugins: + LOG.error("No state configuration file for: %s", plugin_type) @staticmethod def _get_updated_property(new_vertex, graph_vertex, prop): diff --git a/vitrage/entity_graph/transformer_manager.py b/vitrage/entity_graph/transformer_manager.py index e468df34a..2997a7467 100644 --- a/vitrage/entity_graph/transformer_manager.py +++ b/vitrage/entity_graph/transformer_manager.py @@ -36,7 +36,7 @@ class TransformerManager(object): def register_transformer_classes(conf): transformers = {} - for plugin in conf.synchronizer_plugins.plugin_type: + for plugin in conf.plugins.plugin_type: transformers[plugin] = importutils.import_object( conf[plugin].transformer, transformers) diff --git a/vitrage/opts.py b/vitrage/opts.py index bc91b3f9a..2cbc58b86 100644 --- a/vitrage/opts.py +++ b/vitrage/opts.py @@ -37,7 +37,7 @@ def list_opts(): ('api', vitrage.api.OPTS), ('synchronizer', vitrage.synchronizer.OPTS), ('evaluator', vitrage.evaluator.OPTS), - ('synchronizer_plugins', vitrage.synchronizer.plugins.OPTS), + ('plugins', vitrage.synchronizer.plugins.OPTS), ('consistency', vitrage.entity_graph.consistency.OPTS), ('entity_graph', vitrage.entity_graph.OPTS), ('service_credentials', vitrage.keystone_client.OPTS), diff --git a/vitrage/service.py b/vitrage/service.py index 99a690191..95ae21035 100644 --- a/vitrage/service.py +++ b/vitrage/service.py @@ -38,8 +38,8 @@ def prepare_service(args=None, conf=None, config_files=None): conf(args, project='vitrage', validate_default_values=True, default_config_files=config_files) - for plugin_name in conf.synchronizer_plugins.plugin_type: - load_plugin(conf, plugin_name, conf.synchronizer_plugins.plugin_path) + for plugin_name in conf.plugins.plugin_type: + load_plugin(conf, plugin_name, conf.plugins.plugin_path) keystone_client.register_keystoneauth_opts(conf) diff --git a/vitrage/synchronizer/launcher.py b/vitrage/synchronizer/launcher.py index 8e3f6784f..ca09c7cad 100644 --- a/vitrage/synchronizer/launcher.py +++ b/vitrage/synchronizer/launcher.py @@ -59,7 +59,7 @@ class Launcher(object): self.conf[plugin].changes_interval, self.callback) - for plugin in self.conf.synchronizer_plugins.plugin_type + for plugin in self.conf.plugins.plugin_type if opt_exists(self.conf[plugin], CHANGES_INTERVAL)), (SnapshotsService(self.conf, diff --git a/vitrage/tests/functional/entity_graph/consistency/test_consistency.py b/vitrage/tests/functional/entity_graph/consistency/test_consistency.py index 90e7edeab..2052070a0 100644 --- a/vitrage/tests/functional/entity_graph/consistency/test_consistency.py +++ b/vitrage/tests/functional/entity_graph/consistency/test_consistency.py @@ -78,8 +78,7 @@ class TestConsistencyFunctional(TestEntityGraphFunctionalBase): self.conf.register_opts(self.PROCESSOR_OPTS, group='entity_graph') self.conf.register_opts(self.EVALUATOR_OPTS, group='evaluator') self.conf.register_opts(self.SYNCHRONIZER_OPTS, group='synchronizer') - self.conf.register_opts(self.PLUGINS_OPTS, - group='synchronizer_plugins') + self.conf.register_opts(self.PLUGINS_OPTS, group='plugins') self.load_plugins(self.conf) self.processor = Processor(self.conf, self.initialization_status) diff --git a/vitrage/tests/functional/entity_graph/processor/test_processor.py b/vitrage/tests/functional/entity_graph/processor/test_processor.py index ba9df1d11..b5312e24c 100644 --- a/vitrage/tests/functional/entity_graph/processor/test_processor.py +++ b/vitrage/tests/functional/entity_graph/processor/test_processor.py @@ -33,8 +33,7 @@ class TestProcessorFunctional(TestEntityGraphFunctionalBase): super(TestProcessorFunctional, self).setUp() self.conf = cfg.ConfigOpts() self.conf.register_opts(self.PROCESSOR_OPTS, group='entity_graph') - self.conf.register_opts(self.PLUGINS_OPTS, - group='synchronizer_plugins') + self.conf.register_opts(self.PLUGINS_OPTS, group='plugins') self.load_plugins(self.conf) def test_create_entity_graph(self): diff --git a/vitrage/tests/functional/entity_graph/states/test_state_manager.py b/vitrage/tests/functional/entity_graph/states/test_state_manager.py index 5a3c15fff..ede1aa313 100644 --- a/vitrage/tests/functional/entity_graph/states/test_state_manager.py +++ b/vitrage/tests/functional/entity_graph/states/test_state_manager.py @@ -34,8 +34,7 @@ class TestStateManagerFunctional(TestEntityGraphFunctionalBase): super(TestStateManagerFunctional, self).setUp() self.conf = cfg.ConfigOpts() self.conf.register_opts(self.PROCESSOR_OPTS, group='entity_graph') - self.conf.register_opts(self.PLUGINS_OPTS, - group='synchronizer_plugins') + self.conf.register_opts(self.PLUGINS_OPTS, group='plugins') self.load_plugins(self.conf) def test_state_on_update(self): diff --git a/vitrage/tests/functional/evaluator/test_action_executor.py b/vitrage/tests/functional/evaluator/test_action_executor.py index 5356f7e2c..08b4a7c27 100644 --- a/vitrage/tests/functional/evaluator/test_action_executor.py +++ b/vitrage/tests/functional/evaluator/test_action_executor.py @@ -46,11 +46,9 @@ class TestActionExecutor(TestEntityGraphFunctionalBase): def setUpClass(cls): cls.conf = cfg.ConfigOpts() cls.conf.register_opts(cls.PROCESSOR_OPTS, group='entity_graph') - cls.conf.register_opts(cls.PLUGINS_OPTS, - group='synchronizer_plugins') - for plugin_name in cls.conf.synchronizer_plugins.plugin_type: - load_plugin(cls.conf, plugin_name, - cls.conf.synchronizer_plugins.plugin_path) + cls.conf.register_opts(cls.PLUGINS_OPTS, group='plugins') + for plugin_name in cls.conf.plugins.plugin_type: + load_plugin(cls.conf, plugin_name, cls.conf.plugins.plugin_path) def test_execute_update_vertex(self): diff --git a/vitrage/tests/functional/evaluator/test_scenario_evaluator.py b/vitrage/tests/functional/evaluator/test_scenario_evaluator.py index ab6a4766b..4ff5a93f9 100644 --- a/vitrage/tests/functional/evaluator/test_scenario_evaluator.py +++ b/vitrage/tests/functional/evaluator/test_scenario_evaluator.py @@ -46,8 +46,7 @@ class TestScenarioEvaluator(TestEntityGraphFunctionalBase): cls.conf = cfg.ConfigOpts() cls.conf.register_opts(cls.PROCESSOR_OPTS, group='entity_graph') cls.conf.register_opts(cls.EVALUATOR_OPTS, group='evaluator') - cls.conf.register_opts(cls.PLUGINS_OPTS, - group='synchronizer_plugins') + cls.conf.register_opts(cls.PLUGINS_OPTS, group='plugins') TestScenarioEvaluator.load_plugins(cls.conf) cls.scenario_repository = ScenarioRepository(cls.conf) diff --git a/vitrage/tests/unit/entity_graph/base.py b/vitrage/tests/unit/entity_graph/base.py index 4b0c6439e..811619111 100644 --- a/vitrage/tests/unit/entity_graph/base.py +++ b/vitrage/tests/unit/entity_graph/base.py @@ -58,9 +58,8 @@ class TestEntityGraphUnitBase(base.BaseTest): @staticmethod def load_plugins(conf): - for plugin_name in conf.synchronizer_plugins.plugin_type: - load_plugin(conf, plugin_name, - conf.synchronizer_plugins.plugin_path) + for plugin_name in conf.plugins.plugin_type: + load_plugin(conf, plugin_name, conf.plugins.plugin_path) def _create_processor_with_graph(self, conf, processor=None): events = self._create_mock_events() diff --git a/vitrage/tests/unit/entity_graph/processor/base.py b/vitrage/tests/unit/entity_graph/processor/base.py index 7424e2f5c..0f27858e2 100644 --- a/vitrage/tests/unit/entity_graph/processor/base.py +++ b/vitrage/tests/unit/entity_graph/processor/base.py @@ -27,7 +27,7 @@ class TestBaseProcessor(TestEntityGraphUnitBase): super(TestBaseProcessor, self).setUp() self.conf = cfg.ConfigOpts() self.conf.register_opts(self.PLUGINS_OPTS, - group='synchronizer_plugins') + group='plugins') self.load_plugins(self.conf) self.transform = transformer_manager.TransformerManager(self.conf) diff --git a/vitrage/tests/unit/entity_graph/processor/test_processor.py b/vitrage/tests/unit/entity_graph/processor/test_processor.py index edcb68e86..7db57c595 100644 --- a/vitrage/tests/unit/entity_graph/processor/test_processor.py +++ b/vitrage/tests/unit/entity_graph/processor/test_processor.py @@ -45,8 +45,7 @@ class TestProcessor(TestEntityGraphUnitBase): super(TestProcessor, self).setUp() self.conf = cfg.ConfigOpts() self.conf.register_opts(self.PROCESSOR_OPTS, group='entity_graph') - self.conf.register_opts(self.PLUGINS_OPTS, - group='synchronizer_plugins') + self.conf.register_opts(self.PLUGINS_OPTS, group='plugins') self.load_plugins(self.conf) # TODO(Alexey): un skip this test when instance transformer update is ready diff --git a/vitrage/tests/unit/entity_graph/states/test_state_manager.py b/vitrage/tests/unit/entity_graph/states/test_state_manager.py index e91598add..20637c3ae 100644 --- a/vitrage/tests/unit/entity_graph/states/test_state_manager.py +++ b/vitrage/tests/unit/entity_graph/states/test_state_manager.py @@ -51,17 +51,15 @@ class TestStateManager(base.BaseTest): @staticmethod def _load_plugins(conf): - for plugin_name in conf.synchronizer_plugins.plugin_type: - load_plugin(conf, plugin_name, - conf.synchronizer_plugins.plugin_path) + for plugin_name in conf.plugins.plugin_type: + load_plugin(conf, plugin_name, conf.plugins.plugin_path) # noinspection PyAttributeOutsideInit def setUp(self): super(TestStateManager, self).setUp() self.conf = cfg.ConfigOpts() self.conf.register_opts(self.ENTITY_GRAPH_OPTS, group='entity_graph') - self.conf.register_opts(self.PLUGINS_OPTS, - group='synchronizer_plugins') + self.conf.register_opts(self.PLUGINS_OPTS, group='plugins') self._load_plugins(self.conf) def test_load_state_plugins_without_errors(self): @@ -71,7 +69,7 @@ class TestStateManager(base.BaseTest): # test assertions # Total plugins plus the evaluator which is not definable - total_plugins = len(self.conf.synchronizer_plugins.plugin_type) + 1 + total_plugins = len(self.conf.plugins.plugin_type) + 1 self.assertEqual(total_plugins, len(state_manager.states_plugins)) def test_load_state_plugins_with_errors(self): @@ -83,7 +81,7 @@ class TestStateManager(base.BaseTest): ] conf = cfg.ConfigOpts() conf.register_opts(entity_graph_opts, group='entity_graph') - conf.register_opts(self.PLUGINS_OPTS, group='synchronizer_plugins') + conf.register_opts(self.PLUGINS_OPTS, group='plugins') self._load_plugins(conf) # action @@ -94,8 +92,7 @@ class TestStateManager(base.BaseTest): erroneous_states_plugins = 2 num_valid_plugins = len(state_manager.states_plugins) + \ missing_states_plugins + erroneous_states_plugins - self.assertEqual(len(conf.synchronizer_plugins.plugin_type), - num_valid_plugins) + self.assertEqual(len(conf.plugins.plugin_type), num_valid_plugins) def test_normalize_state(self): # setup diff --git a/vitrage/tests/unit/entity_graph/test_transformer_manager.py b/vitrage/tests/unit/entity_graph/test_transformer_manager.py index 3a85d03e4..4e6c8bcc0 100644 --- a/vitrage/tests/unit/entity_graph/test_transformer_manager.py +++ b/vitrage/tests/unit/entity_graph/test_transformer_manager.py @@ -53,10 +53,11 @@ class TransformerManagerTest(base.BaseTest): @classmethod def setUpClass(cls): cls.conf = cfg.ConfigOpts() - cls.conf.register_opts(cls.OPTS, group='synchronizer_plugins') - for plugin_name in cls.conf.synchronizer_plugins.plugin_type: - load_plugin(cls.conf, plugin_name, - cls.conf.synchronizer_plugins.plugin_path) + cls.conf.register_opts(cls.OPTS, group='plugins') + + for plugin_name in cls.conf.plugins.plugin_type: + load_plugin(cls.conf, plugin_name, cls.conf.plugins.plugin_path) + cls.manager = TransformerManager(cls.conf) def test_transformer_registration_nagios(self):