Rename Mistral notifier queue

In case there is an execute_mistral action in one of the templates, the
evaluator used to send an event to a queue with a 'mistral' topic.
This change adds a 'vitrage_notifier' prefix to the queue name, to make
it more clear that this is a Vitrage queue.

Change-Id: I23b5e43c931381cc4ec628659a1f1f250e308c82
This commit is contained in:
Ifat Afek 2018-04-03 14:09:44 +00:00
parent fde4adc98a
commit 5c4bd36e80
4 changed files with 21 additions and 3 deletions

View File

@ -12,4 +12,13 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
__author__ = 'stack' from oslo_config import cfg
# Register options for the service
OPTS = [
cfg.StrOpt('evaluator_notification_topic_prefix',
default='vitrage_evaluator_notifications',
help='A prefix of the topic on which events will be sent from '
'the evaluator to the specific notifiers')
]

View File

@ -34,6 +34,9 @@ class EvaluatorNotifier(object):
LOG.info('Evaluator Notifier is disabled') LOG.info('Evaluator Notifier is disabled')
return return
topic_prefix = \
conf.evaluator_actions.evaluator_notification_topic_prefix
for notifier in notifier_plugins: for notifier in notifier_plugins:
LOG.debug('Adding evaluator notifier %s', notifier) LOG.debug('Adding evaluator notifier %s', notifier)
@ -41,7 +44,7 @@ class EvaluatorNotifier(object):
get_transport(conf), get_transport(conf),
driver='messagingv2', driver='messagingv2',
publisher_id='vitrage.evaluator', publisher_id='vitrage.evaluator',
topics=[notifier]) topics=[topic_prefix + '.' + notifier])
except Exception as e: except Exception as e:
LOG.info('Evaluator Notifier - missing configuration %s' % str(e)) LOG.info('Evaluator Notifier - missing configuration %s' % str(e))

View File

@ -75,10 +75,14 @@ class VitrageNotifierService(os_service.Service):
endpoint=VitrageDefaultEventEndpoint( endpoint=VitrageDefaultEventEndpoint(
self.notifiers)) self.notifiers))
topic_prefix = \
conf.evaluator_actions.evaluator_notification_topic_prefix
for notifier in self.notifiers: for notifier in self.notifiers:
if notifier.use_private_topic(): if notifier.use_private_topic():
self._init_notifier(transport=transport, self._init_notifier(transport=transport,
topic=notifier.get_notifier_name(), topic=topic_prefix + '.' +
notifier.get_notifier_name(),
endpoint=notifier) endpoint=notifier)
def _init_notifier(self, transport, topic, endpoint): def _init_notifier(self, transport, topic, endpoint):

View File

@ -22,6 +22,7 @@ import vitrage.api
import vitrage.datasources import vitrage.datasources
import vitrage.entity_graph.consistency import vitrage.entity_graph.consistency
import vitrage.evaluator import vitrage.evaluator
import vitrage.evaluator.actions
import vitrage.keystone_client import vitrage.keystone_client
import vitrage.machine_learning import vitrage.machine_learning
import vitrage.machine_learning.plugins.jaccard_correlation import vitrage.machine_learning.plugins.jaccard_correlation
@ -47,6 +48,7 @@ def list_opts():
('api', vitrage.api.OPTS), ('api', vitrage.api.OPTS),
('datasources', vitrage.datasources.OPTS), ('datasources', vitrage.datasources.OPTS),
('evaluator', vitrage.evaluator.OPTS), ('evaluator', vitrage.evaluator.OPTS),
('evaluator_actions', vitrage.evaluator.actions.OPTS),
('consistency', vitrage.entity_graph.consistency.OPTS), ('consistency', vitrage.entity_graph.consistency.OPTS),
('database', vitrage.storage.OPTS), ('database', vitrage.storage.OPTS),
('persistency', vitrage.persistency.OPTS), ('persistency', vitrage.persistency.OPTS),