mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-05-02 06:30:55 +08:00
Introduce pluggable backends.
This allows an operator to write a custom messaging backend to handle whatever transport and format.
This commit is contained in:
@@ -26,9 +26,9 @@
|
||||
|
||||
import imp
|
||||
import os
|
||||
import pkg_resources
|
||||
import re
|
||||
|
||||
from os import sys
|
||||
import sys
|
||||
|
||||
from module_build_service import logger
|
||||
|
||||
@@ -500,9 +500,16 @@ class Config(object):
|
||||
self._log_level = logger.str_to_log_level(level)
|
||||
|
||||
def _setifok_messaging(self, s):
|
||||
""" Validate that the specified messaging backend corresponds with one
|
||||
of the installed plugins. The MBS core provides two such plugins, but
|
||||
a third-party could install another usable one.
|
||||
"""
|
||||
entrypoints = pkg_resources.iter_entry_points('mbs.messaging_backends')
|
||||
installed_backends = [e.name for e in entrypoints]
|
||||
s = str(s)
|
||||
if s not in ("fedmsg", "amq", "in_memory"):
|
||||
raise ValueError("Unsupported messaging system.")
|
||||
if s not in installed_backends:
|
||||
raise ValueError("Uninstalled messaging system. %r not in %r" % (
|
||||
s, installed_backends))
|
||||
self._messaging = s
|
||||
|
||||
def _setifok_amq_recv_addresses(self, l):
|
||||
|
||||
Reference in New Issue
Block a user