Loading monitor.py +8 −2 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ import signal import socket import subprocess import tempfile import uuid from urllib import parse from typing import Iterable, Set, TextIO, Union Loading Loading @@ -42,6 +43,8 @@ class StreamConfig: Manage an Nginx stream configuration """ uuid = uuid.uuid1(clock_seq=0) def __init__(self, name, **values): self.name = name self.path = None Loading @@ -51,7 +54,10 @@ class StreamConfig: """ Add the stream config """ self.path = pathlib.Path(nginx_base).joinpath(f'streams/{self.name}.conf') uid = self.uuid while self.path is None or self.path.exists(): uid = uuid.uuid5(uid, self.name) self.path = pathlib.Path(nginx_base).joinpath(f'streams/{uid}.conf') template = engine.get_template('stream.conf') with self.path.open('w') as conf: conf.writelines(template.stream(**self.vals)) Loading Loading @@ -319,7 +325,7 @@ def node_ports(service: dict, host_addrs: Set[IPAddress]): for port in ports: logger.debug("generating for %s and %s", addr, port['name']) yield uid, StreamConfig( name=f"{name}.{port['name']}", name=f"{name}.{port['name']} on {addr}", protocol=port['protocol'], external_port=(addr, port['port']), # TODO: Awaiting #20 Loading Loading
monitor.py +8 −2 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ import signal import socket import subprocess import tempfile import uuid from urllib import parse from typing import Iterable, Set, TextIO, Union Loading Loading @@ -42,6 +43,8 @@ class StreamConfig: Manage an Nginx stream configuration """ uuid = uuid.uuid1(clock_seq=0) def __init__(self, name, **values): self.name = name self.path = None Loading @@ -51,7 +54,10 @@ class StreamConfig: """ Add the stream config """ self.path = pathlib.Path(nginx_base).joinpath(f'streams/{self.name}.conf') uid = self.uuid while self.path is None or self.path.exists(): uid = uuid.uuid5(uid, self.name) self.path = pathlib.Path(nginx_base).joinpath(f'streams/{uid}.conf') template = engine.get_template('stream.conf') with self.path.open('w') as conf: conf.writelines(template.stream(**self.vals)) Loading Loading @@ -319,7 +325,7 @@ def node_ports(service: dict, host_addrs: Set[IPAddress]): for port in ports: logger.debug("generating for %s and %s", addr, port['name']) yield uid, StreamConfig( name=f"{name}.{port['name']}", name=f"{name}.{port['name']} on {addr}", protocol=port['protocol'], external_port=(addr, port['port']), # TODO: Awaiting #20 Loading