From 1982a3c869a1aaf837483087cd442e0259108e0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Sun, 25 Mar 2018 16:36:31 +0200 Subject: [PATCH] Rename TFWENV and TAOENV constants to use capital letters --- lib/tao/config/envvars.py | 2 +- lib/tfw/components/mixins/supervisor_mixin.py | 4 ++-- lib/tfw/components/terminado_event_handler.py | 8 ++++---- lib/tfw/components/terminado_mini_server.py | 6 +++--- lib/tfw/config/envvars.py | 2 +- lib/tfw/networking/controller_connector.py | 4 ++-- lib/tfw/networking/event_handlers/server_connector.py | 6 +++--- lib/tfw/networking/server/event_handler_connector.py | 6 +++--- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lib/tao/config/envvars.py b/lib/tao/config/envvars.py index 6262ead..474e597 100644 --- a/lib/tao/config/envvars.py +++ b/lib/tao/config/envvars.py @@ -1,3 +1,3 @@ from envvars import generate_namedtuple_from_prefixed_envvars -taoenv = generate_namedtuple_from_prefixed_envvars('AVATAO_', 'taoenvtuple') +TAOENV = generate_namedtuple_from_prefixed_envvars('AVATAO_', 'taoenvtuple') diff --git a/lib/tfw/components/mixins/supervisor_mixin.py b/lib/tfw/components/mixins/supervisor_mixin.py index 1ed66b3..750225a 100644 --- a/lib/tfw/components/mixins/supervisor_mixin.py +++ b/lib/tfw/components/mixins/supervisor_mixin.py @@ -3,11 +3,11 @@ from xmlrpc.client import Fault as SupervisorFault from contextlib import suppress from os import remove -from tfw.config import tfwenv +from tfw.config import TFWENV class SupervisorMixin: - supervisor = xmlrpc.client.ServerProxy(tfwenv.SUPERVISOR_HTTP_URI).supervisor + supervisor = xmlrpc.client.ServerProxy(TFWENV.SUPERVISOR_HTTP_URI).supervisor def stop_process(self, process_name): with suppress(SupervisorFault): diff --git a/lib/tfw/components/terminado_event_handler.py b/lib/tfw/components/terminado_event_handler.py index f0279f0..d9262df 100644 --- a/lib/tfw/components/terminado_event_handler.py +++ b/lib/tfw/components/terminado_event_handler.py @@ -1,7 +1,7 @@ from tfw.components.terminado_mini_server import TerminadoMiniServer from tfw.components.history_monitor import HistoryMonitor from tfw.event_handler_base import TriggerlessEventHandler -from tfw.config import tfwenv +from tfw.config import TFWENV from tfw.config.logs import logging LOG = logging.getLogger(__name__) @@ -10,9 +10,9 @@ LOG = logging.getLogger(__name__) class TerminadoEventHandler(TriggerlessEventHandler): def __init__(self, key): super().__init__(key) - self.working_directory = tfwenv.TERMINADO_DIR - self._historymonitor = HistoryMonitor(tfwenv.HISTFILE) - self.terminado_server = TerminadoMiniServer('/terminal', tfwenv.TERMINADO_PORT, tfwenv.TERMINADO_WD, ['bash']) + self.working_directory = TFWENV.TERMINADO_DIR + self._historymonitor = HistoryMonitor(TFWENV.HISTFILE) + self.terminado_server = TerminadoMiniServer('/terminal', TFWENV.TERMINADO_PORT, TFWENV.TERMINADO_WD, ['bash']) self.commands = {'write': self.write, 'read': self.read} self._historymonitor.watch() diff --git a/lib/tfw/components/terminado_mini_server.py b/lib/tfw/components/terminado_mini_server.py index ff85f39..613e749 100644 --- a/lib/tfw/components/terminado_mini_server.py +++ b/lib/tfw/components/terminado_mini_server.py @@ -2,7 +2,7 @@ from tornado.ioloop import IOLoop from tornado.web import Application from terminado import TermSocket, SingleTermManager -from tfw.config import tfwenv +from tfw.config import TFWENV from tfw.config.logs import logging LOG = logging.getLogger(__name__) @@ -42,6 +42,6 @@ class TerminadoMiniServer: if __name__ == '__main__': - LOG.info('Terminado Mini Server listening on %s', tfwenv.TERMINADO_PORT) - TerminadoMiniServer('/terminal', tfwenv.TERMINADO_PORT, tfwenv.TERMINADO_WD, ['bash']).listen() + LOG.info('Terminado Mini Server listening on %s', TFWENV.TERMINADO_PORT) + TerminadoMiniServer('/terminal', TFWENV.TERMINADO_PORT, TFWENV.TERMINADO_WD, ['bash']).listen() IOLoop.instance().start() diff --git a/lib/tfw/config/envvars.py b/lib/tfw/config/envvars.py index d94be2b..0da3db5 100644 --- a/lib/tfw/config/envvars.py +++ b/lib/tfw/config/envvars.py @@ -1,3 +1,3 @@ from envvars import generate_namedtuple_from_prefixed_envvars -tfwenv = generate_namedtuple_from_prefixed_envvars('TFW_', 'tfwenvtuple') +TFWENV = generate_namedtuple_from_prefixed_envvars('TFW_', 'tfwenvtuple') diff --git a/lib/tfw/networking/controller_connector.py b/lib/tfw/networking/controller_connector.py index 5646b8d..d4f3f85 100644 --- a/lib/tfw/networking/controller_connector.py +++ b/lib/tfw/networking/controller_connector.py @@ -1,7 +1,7 @@ import zmq from zmq.eventloop.zmqstream import ZMQStream -from tfw.config import tfwenv +from tfw.config import TFWENV from tfw.networking.zmq_connector_base import ZMQConnectorBase @@ -9,7 +9,7 @@ class ControllerConnector(ZMQConnectorBase): def __init__(self, zmq_context=None): super(ControllerConnector, self).__init__(zmq_context) self._zmq_rep_socket = self._zmq_context.socket(zmq.REP) - self._zmq_rep_socket.connect('tcp://localhost:{}'.format(tfwenv.CONTROLLER_PORT)) + self._zmq_rep_socket.connect('tcp://localhost:{}'.format(TFWENV.CONTROLLER_PORT)) self._zmq_rep_stream = ZMQStream(self._zmq_rep_socket) self.register_callback = self._zmq_rep_stream.on_recv_stream diff --git a/lib/tfw/networking/event_handlers/server_connector.py b/lib/tfw/networking/event_handlers/server_connector.py index 96accf0..b9040ad 100644 --- a/lib/tfw/networking/event_handlers/server_connector.py +++ b/lib/tfw/networking/event_handlers/server_connector.py @@ -4,7 +4,7 @@ import zmq from zmq.eventloop.zmqstream import ZMQStream from tfw.networking.serialization import serialize_all -from tfw.config import tfwenv +from tfw.config import TFWENV from tfw.networking.zmq_connector_base import ZMQConnectorBase @@ -12,7 +12,7 @@ class ServerDownlinkConnector(ZMQConnectorBase): def __init__(self, zmq_context=None): super(ServerDownlinkConnector, self).__init__(zmq_context) self._zmq_sub_socket = self._zmq_context.socket(zmq.SUB) - self._zmq_sub_socket.connect('tcp://localhost:{}'.format(tfwenv.PUBLISHER_PORT)) + self._zmq_sub_socket.connect('tcp://localhost:{}'.format(TFWENV.PUBLISHER_PORT)) self._zmq_sub_stream = ZMQStream(self._zmq_sub_socket) self.subscribe = partial(self._zmq_sub_socket.setsockopt_string, zmq.SUBSCRIBE) @@ -24,7 +24,7 @@ class ServerUplinkConnector(ZMQConnectorBase): def __init__(self, zmq_context=None): super(ServerUplinkConnector, self).__init__(zmq_context) self._zmq_push_socket = self._zmq_context.socket(zmq.PUSH) - self._zmq_push_socket.connect('tcp://localhost:{}'.format(tfwenv.RECEIVER_PORT)) + self._zmq_push_socket.connect('tcp://localhost:{}'.format(TFWENV.RECEIVER_PORT)) def send_to_eventhandler(self, key, message): message['data']['key'] = key diff --git a/lib/tfw/networking/server/event_handler_connector.py b/lib/tfw/networking/server/event_handler_connector.py index c8428b7..000b9ae 100644 --- a/lib/tfw/networking/server/event_handler_connector.py +++ b/lib/tfw/networking/server/event_handler_connector.py @@ -3,7 +3,7 @@ from zmq.eventloop.zmqstream import ZMQStream from tfw.networking.zmq_connector_base import ZMQConnectorBase from tfw.networking.serialization import serialize_all -from tfw.config import tfwenv +from tfw.config import TFWENV from tfw.config.logs import logging LOG = logging.getLogger(__name__) @@ -14,7 +14,7 @@ class EventHandlerDownlinkConnector(ZMQConnectorBase): super(EventHandlerDownlinkConnector, self).__init__(zmq_context) self._zmq_pull_socket = self._zmq_context.socket(zmq.PULL) self._zmq_pull_stream = ZMQStream(self._zmq_pull_socket) - address = 'tcp://*:{}'.format(tfwenv.RECEIVER_PORT) + address = 'tcp://*:{}'.format(TFWENV.RECEIVER_PORT) self._zmq_pull_socket.bind(address) LOG.debug('Pull socket bound to %s', address) @@ -23,7 +23,7 @@ class EventHandlerUplinkConnector(ZMQConnectorBase): def __init__(self, zmq_context=None): super(EventHandlerUplinkConnector, self).__init__(zmq_context) self._zmq_pub_socket = self._zmq_context.socket(zmq.PUB) - address = 'tcp://*:{}'.format(tfwenv.PUBLISHER_PORT) + address = 'tcp://*:{}'.format(TFWENV.PUBLISHER_PORT) self._zmq_pub_socket.bind(address) LOG.debug('Pub socket bound to %s', address)