diff options
author | asteroide <thomas.duval@orange.com> | 2017-07-25 17:47:02 +0200 |
---|---|---|
committer | asteroide <thomas.duval@orange.com> | 2017-07-25 17:47:02 +0200 |
commit | 62579d1acbef875159c953222a275033e51ec0cd (patch) | |
tree | fd6ad26135f9628c4895f7b5f6aa41e316686b93 /moonv4 | |
parent | 000ba3d0d4ac08a59a3f8a78faa450e565bae0c3 (diff) |
Update to get configuration from the consul
Change-Id: I0367e49caa00462fde20dcf83667788492a6bb0d
Diffstat (limited to 'moonv4')
-rw-r--r-- | moonv4/moon_manager/moon_manager/messenger.py | 9 | ||||
-rw-r--r-- | moonv4/moon_manager/moon_manager/server.py | 6 |
2 files changed, 12 insertions, 3 deletions
diff --git a/moonv4/moon_manager/moon_manager/messenger.py b/moonv4/moon_manager/moon_manager/messenger.py index 3c44b6f6..76ba6dad 100644 --- a/moonv4/moon_manager/moon_manager/messenger.py +++ b/moonv4/moon_manager/moon_manager/messenger.py @@ -15,8 +15,9 @@ from moon_manager.api.pdp import PDP from moon_manager.api.master import Master from moon_utilities.security_functions import call from moon_utilities.exceptions import IntraExtensionUnknown +from moon_utilities import configuration -LOG = logging.getLogger(__name__) +LOG = logging.getLogger("moon.manager.messenger") CONF = cfg.CONF @@ -24,6 +25,7 @@ class Server: def __init__(self): self.TOPIC = "moon_manager" + cfg.CONF.transport_url = self.__get_transport_url() self.transport = oslo_messaging.get_transport(cfg.CONF) self.target = oslo_messaging.Target(topic=self.TOPIC, server='moon_manager_server1') # ctx = {'user_id': 'admin', 'id': intra_extension_id, 'method': 'get_intra_extensions'} @@ -60,6 +62,11 @@ class Server: executor='threading', access_policy=oslo_messaging.DefaultRPCAccessPolicy) + @staticmethod + def __get_transport_url(): + messenger = configuration.get_configuration(configuration.MESSENGER)["messenger"] + return messenger['url'] + def run(self): try: self.server.start() diff --git a/moonv4/moon_manager/moon_manager/server.py b/moonv4/moon_manager/moon_manager/server.py index 715a74c3..56ba1e95 100644 --- a/moonv4/moon_manager/moon_manager/server.py +++ b/moonv4/moon_manager/moon_manager/server.py @@ -6,10 +6,10 @@ import os from oslo_config import cfg from oslo_log import log as logging -from moon_utilities import options # noqa +from moon_utilities import configuration from moon_manager.messenger import Server -LOG = logging.getLogger(__name__) +LOG = logging.getLogger("moon.manager") CONF = cfg.CONF DOMAIN = "moon_manager" @@ -17,6 +17,8 @@ __CWD__ = os.path.dirname(os.path.abspath(__file__)) def main(): + configuration.init_logging() + configuration.add_component("manager", "manager") server = Server() server.run() |