ominfra 0.0.0.dev193__py3-none-any.whl → 0.0.0.dev194__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- ominfra/clouds/aws/journald2aws/main.py +5 -2
- ominfra/manage/deploy/conf/manager.py +2 -2
- ominfra/manage/main.py +3 -3
- ominfra/scripts/journald2aws.py +446 -95
- ominfra/scripts/manage.py +467 -168
- ominfra/scripts/supervisor.py +1055 -659
- ominfra/supervisor/configs.py +4 -3
- ominfra/supervisor/main.py +2 -2
- {ominfra-0.0.0.dev193.dist-info → ominfra-0.0.0.dev194.dist-info}/METADATA +4 -4
- {ominfra-0.0.0.dev193.dist-info → ominfra-0.0.0.dev194.dist-info}/RECORD +14 -15
- ominfra/configs.py +0 -102
- {ominfra-0.0.0.dev193.dist-info → ominfra-0.0.0.dev194.dist-info}/LICENSE +0 -0
- {ominfra-0.0.0.dev193.dist-info → ominfra-0.0.0.dev194.dist-info}/WHEEL +0 -0
- {ominfra-0.0.0.dev193.dist-info → ominfra-0.0.0.dev194.dist-info}/entry_points.txt +0 -0
- {ominfra-0.0.0.dev193.dist-info → ominfra-0.0.0.dev194.dist-info}/top_level.txt +0 -0
ominfra/supervisor/configs.py
CHANGED
@@ -5,8 +5,9 @@ import signal
|
|
5
5
|
import tempfile
|
6
6
|
import typing as ta
|
7
7
|
|
8
|
-
from
|
9
|
-
from
|
8
|
+
from omlish.configs.processing.names import build_config_named_children
|
9
|
+
from omlish.configs.types import ConfigMap
|
10
|
+
|
10
11
|
from .utils.fs import check_existing_dir
|
11
12
|
from .utils.fs import check_path_with_existing_dir
|
12
13
|
from .utils.strings import parse_bytes_size
|
@@ -282,7 +283,7 @@ class ServerConfig:
|
|
282
283
|
##
|
283
284
|
|
284
285
|
|
285
|
-
def prepare_process_group_config(dct:
|
286
|
+
def prepare_process_group_config(dct: ConfigMap) -> ConfigMap:
|
286
287
|
out = dict(dct)
|
287
288
|
out['processes'] = build_config_named_children(out.get('processes'))
|
288
289
|
return out
|
ominfra/supervisor/main.py
CHANGED
@@ -35,12 +35,12 @@ import os.path
|
|
35
35
|
import typing as ta
|
36
36
|
|
37
37
|
from omlish.http.coro.server import CoroHttpServer
|
38
|
+
from omlish.lite.configs import load_config_file_obj
|
38
39
|
from omlish.lite.inject import inj
|
39
40
|
from omlish.lite.runtime import is_debugger_attached
|
40
41
|
from omlish.logs.standard import configure_standard_logging
|
41
42
|
from omlish.os.journald import journald_log_handler_factory
|
42
43
|
|
43
|
-
from ..configs import read_config_file
|
44
44
|
from .configs import ServerConfig
|
45
45
|
from .configs import prepare_server_config
|
46
46
|
from .inject import bind_server
|
@@ -91,7 +91,7 @@ def main(
|
|
91
91
|
|
92
92
|
# if we hup, restart by making a new Supervisor()
|
93
93
|
for epoch in itertools.count():
|
94
|
-
config =
|
94
|
+
config = load_config_file_obj(
|
95
95
|
os.path.expanduser(cf),
|
96
96
|
ServerConfig,
|
97
97
|
prepare=prepare_server_config,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ominfra
|
3
|
-
Version: 0.0.0.
|
3
|
+
Version: 0.0.0.dev194
|
4
4
|
Summary: ominfra
|
5
5
|
Author: wrmsr
|
6
6
|
License: BSD-3-Clause
|
@@ -12,9 +12,9 @@ Classifier: Operating System :: OS Independent
|
|
12
12
|
Classifier: Operating System :: POSIX
|
13
13
|
Requires-Python: >=3.12
|
14
14
|
License-File: LICENSE
|
15
|
-
Requires-Dist: omdev==0.0.0.
|
16
|
-
Requires-Dist: omlish==0.0.0.
|
17
|
-
Requires-Dist: omserv==0.0.0.
|
15
|
+
Requires-Dist: omdev==0.0.0.dev194
|
16
|
+
Requires-Dist: omlish==0.0.0.dev194
|
17
|
+
Requires-Dist: omserv==0.0.0.dev194
|
18
18
|
Provides-Extra: all
|
19
19
|
Requires-Dist: paramiko~=3.5; extra == "all"
|
20
20
|
Requires-Dist: asyncssh~=2.18; extra == "all"
|
@@ -2,7 +2,6 @@ ominfra/.manifests.json,sha256=8KREXxMAlsilZOktXPYru1ND3V5hFI22vnrp6hT3bio,589
|
|
2
2
|
ominfra/__about__.py,sha256=_gUs3H7uunGy5IfGw3mq4dFJWaF1mecSPruJPyjbs7Y,741
|
3
3
|
ominfra/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
4
|
ominfra/cmds.py,sha256=E0AfnvEmnKntXWvmLW5L05_NeDpBET1VBXn7vV6EwBQ,2083
|
5
|
-
ominfra/configs.py,sha256=Zj7ZHDmnhg1TFRntAFExpYDfUrcOGGe7oRRoKZsnC6M,2432
|
6
5
|
ominfra/pyremote.py,sha256=HLfAZl3Xw5CpxLS5PS380zqCyE7n3vKVksIYT2Fbdc8,15197
|
7
6
|
ominfra/ssh.py,sha256=jQpc4WvkMckIfk4vILda8zFaeharRqc_6wxW50b0OjQ,5431
|
8
7
|
ominfra/systemd.py,sha256=d61NVrJoItzSaqhMDgKGrQjbrxEVAujUMDsj8WggXos,1022
|
@@ -19,7 +18,7 @@ ominfra/clouds/aws/journald2aws/__init__.py,sha256=Y3l4WY4JRi2uLG6kgbGp93fuGfkxk
|
|
19
18
|
ominfra/clouds/aws/journald2aws/__main__.py,sha256=d23loR_cKfTYZwYiqpt_CmKI7dd5WcYFgIYzqMep75E,68
|
20
19
|
ominfra/clouds/aws/journald2aws/cursor.py,sha256=tQ7O6BHlEdaalbiI_Rqagj0aHfdtTQ_ZJwdOSRUjNvQ,1173
|
21
20
|
ominfra/clouds/aws/journald2aws/driver.py,sha256=b3XfSlIBWAWJLImmyh1ZK9FpdNAYNZ2YZeCv_Q9GckM,6111
|
22
|
-
ominfra/clouds/aws/journald2aws/main.py,sha256=
|
21
|
+
ominfra/clouds/aws/journald2aws/main.py,sha256=4qWnw33cTPUW1CU4_9ojkn0wRStANrQzSI_cXpyuOf8,2202
|
23
22
|
ominfra/clouds/aws/journald2aws/poster.py,sha256=hz1XuctW8GtLmfjhRvCFY6py52D4BzXHYny5XKFpHSA,2833
|
24
23
|
ominfra/clouds/gcp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
25
24
|
ominfra/clouds/gcp/auth.py,sha256=rDIiOH5gP3OSIaMC5Lp8yAD4zWuLDEYlFu37mDx5YDA,1360
|
@@ -34,7 +33,7 @@ ominfra/manage/bootstrap.py,sha256=1RIRhVkUZjxZcZerHMg8U6xgWhhemGgPN5cDye8dQ68,4
|
|
34
33
|
ominfra/manage/bootstrap_.py,sha256=B9UfR9J7mS3J54PFaSe1MQS5lCnKgxt5dDRJ9mnHYwg,656
|
35
34
|
ominfra/manage/config.py,sha256=1y2N_8nXHBZc6YbW6BaRZoDDCTBmiHuWtTOQ7zdr5VE,184
|
36
35
|
ominfra/manage/inject.py,sha256=_FVaMZUBKi-oObv14H77luWYCodxNJJD1t4pNQzckFE,2030
|
37
|
-
ominfra/manage/main.py,sha256=
|
36
|
+
ominfra/manage/main.py,sha256=1-PIAWnmd9XIy8pVcWGsME9xNTSj_t0sWWQTq9GYIzc,4403
|
38
37
|
ominfra/manage/marshal.py,sha256=WKj7IU9bo4fBMSSzT6ZMm_WFalXIJZ-V7j8oi92fNhk,305
|
39
38
|
ominfra/manage/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
40
39
|
ominfra/manage/commands/base.py,sha256=LtaI0AgnplttQK7gNncNItq8yuTZQimJTaprVpZktI8,3993
|
@@ -62,7 +61,7 @@ ominfra/manage/deploy/types.py,sha256=ZcIoheZ3zW7n0IZiqTRW_Uo3JyWWeWg5nyKGryvGc2
|
|
62
61
|
ominfra/manage/deploy/venvs.py,sha256=PlvhyhZavgiSwGt8BXrhoSwQFVKpU0zCtq2C2N1_8Ak,1696
|
63
62
|
ominfra/manage/deploy/conf/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
64
63
|
ominfra/manage/deploy/conf/inject.py,sha256=xHZQr7oaJCxaKgpJ0H-hgiQNGt4QsskhT3f5v7xrFwE,451
|
65
|
-
ominfra/manage/deploy/conf/manager.py,sha256=
|
64
|
+
ominfra/manage/deploy/conf/manager.py,sha256=0dKI9aDsq31ziKifS_BOnUjec-HR4i0dHvEcF6z-Vo8,8322
|
66
65
|
ominfra/manage/deploy/conf/specs.py,sha256=_TCIT5nokZiKEJBL8ZArmPiRt1GEUUC5TaE0QboNhq4,2191
|
67
66
|
ominfra/manage/deploy/paths/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
68
67
|
ominfra/manage/deploy/paths/inject.py,sha256=X81C-Qhef1LQ7tILWvkomBwFTvgooLVmWRnKL7TeVoI,596
|
@@ -93,13 +92,13 @@ ominfra/manage/targets/connection.py,sha256=rVI1YJxFClcF-sdttqWyIz9_XjPI01GUdwxY
|
|
93
92
|
ominfra/manage/targets/inject.py,sha256=P4597xWM-V3I_gCt2O71OLhYQkkXtuJvkYRsIbhhMcE,1561
|
94
93
|
ominfra/manage/targets/targets.py,sha256=7GP6UAZyJFEhpkJN6UQdpr_WN3p7C76v-s445y-WB6U,1885
|
95
94
|
ominfra/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
96
|
-
ominfra/scripts/journald2aws.py,sha256=
|
97
|
-
ominfra/scripts/manage.py,sha256=
|
98
|
-
ominfra/scripts/supervisor.py,sha256=
|
95
|
+
ominfra/scripts/journald2aws.py,sha256=Bo_24qN3YI_72BcZYBHid9_SJWnCAmbKRJ3-wE6dGMU,166250
|
96
|
+
ominfra/scripts/manage.py,sha256=rsfvEfHm311jZ1uE90DGL2HQqZLvg36-Pybszoywjl4,353278
|
97
|
+
ominfra/scripts/supervisor.py,sha256=O0IETZgsTNq8nw_F5mL3Qkk3hHtvRNtZTeAsCixzZXw,291712
|
99
98
|
ominfra/supervisor/LICENSE.txt,sha256=yvqaMNsDhWxziHa9ien6qCW1SkZv-DQlAg96XjfSee8,1746
|
100
99
|
ominfra/supervisor/__init__.py,sha256=Y3l4WY4JRi2uLG6kgbGp93fuGfkxkKwZDvhsa0Rwgtk,15
|
101
100
|
ominfra/supervisor/__main__.py,sha256=I0yFw-C08OOiZ3BF6lF1Oiv789EQXu-_j6whDhQUTEA,66
|
102
|
-
ominfra/supervisor/configs.py,sha256=
|
101
|
+
ominfra/supervisor/configs.py,sha256=zpNZmei-Ajild6WNIGnxsPMGbGBFzr0K81L_gR0vBIA,13847
|
103
102
|
ominfra/supervisor/dispatchers.py,sha256=zXLwQS4Vc6dWw5o9QOL04UMDt7w6CKu9wf19CjUiS2Q,1005
|
104
103
|
ominfra/supervisor/dispatchersimpl.py,sha256=q3dEyOHWTPKm28nmAGisjgIW1BX6O3-SzbYa7nWuTEs,11349
|
105
104
|
ominfra/supervisor/events.py,sha256=XGrtzHr1xm0dwjz329fn9eR0_Ap-LQL6Sk8LJ8eVDEo,6692
|
@@ -109,7 +108,7 @@ ominfra/supervisor/groupsimpl.py,sha256=PCDyc_Wc-pnvIj56_aEyiA5exCpK6n9iErqnJzO2
|
|
109
108
|
ominfra/supervisor/http.py,sha256=Tl5eT6dyf4KuQXKbhGo1B6CFEzUDtPl_DZAuUFVD9zI,3453
|
110
109
|
ominfra/supervisor/inject.py,sha256=IeR-WKvK1sGNxMe6G2OBT5kSP7EUP5ipkDgcUFmDPCA,4838
|
111
110
|
ominfra/supervisor/io.py,sha256=moaGNaPuYXEAUzLg8Qjo05DEIcOUNYUj8SSr8eT0d24,3198
|
112
|
-
ominfra/supervisor/main.py,sha256=
|
111
|
+
ominfra/supervisor/main.py,sha256=GjZXBnfv_f3eIrjiGsJ_aLzynZXovZeY5BNyIptS2Gs,4269
|
113
112
|
ominfra/supervisor/pipes.py,sha256=2ZihNTnRNjnIPOtPbm3_pyqO15f7BNs7WnNtO5V8ahM,2231
|
114
113
|
ominfra/supervisor/privileges.py,sha256=kaRTHI7XjqzxEWCeHp3_0J0Vc4gSPugRbXEwxuw6MYE,2054
|
115
114
|
ominfra/supervisor/process.py,sha256=UaubVxsxVqDnbuWVpTH0DTGbJGLO0vGJ9mNcvy2kCXM,217
|
@@ -137,9 +136,9 @@ ominfra/tailscale/api.py,sha256=C5-t_b6jZXUWcy5k8bXm7CFnk73pSdrlMOgGDeGVrpw,1370
|
|
137
136
|
ominfra/tailscale/cli.py,sha256=3FnJbgpLw6gInTfhERd1mDy9ijjMUGxkdYVo43Tnxx4,3555
|
138
137
|
ominfra/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
139
138
|
ominfra/tools/listresources.py,sha256=4qVg5txsb10EHhvqXXeM6gJ2jx9LbroEnPydDv1uXs0,6176
|
140
|
-
ominfra-0.0.0.
|
141
|
-
ominfra-0.0.0.
|
142
|
-
ominfra-0.0.0.
|
143
|
-
ominfra-0.0.0.
|
144
|
-
ominfra-0.0.0.
|
145
|
-
ominfra-0.0.0.
|
139
|
+
ominfra-0.0.0.dev194.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
|
140
|
+
ominfra-0.0.0.dev194.dist-info/METADATA,sha256=Mt6wkbgL4MtaixU5KmXhJ7SaxSqpw10RmamlQgUugFE,767
|
141
|
+
ominfra-0.0.0.dev194.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
142
|
+
ominfra-0.0.0.dev194.dist-info/entry_points.txt,sha256=kgecQ2MgGrM9qK744BoKS3tMesaC3yjLnl9pa5CRczg,37
|
143
|
+
ominfra-0.0.0.dev194.dist-info/top_level.txt,sha256=E-b2OHkk_AOBLXHYZQ2EOFKl-_6uOGd8EjeG-Zy6h_w,8
|
144
|
+
ominfra-0.0.0.dev194.dist-info/RECORD,,
|
ominfra/configs.py
DELETED
@@ -1,102 +0,0 @@
|
|
1
|
-
# ruff: noqa: UP006 UP007
|
2
|
-
# @omlish-lite
|
3
|
-
import json
|
4
|
-
import os.path
|
5
|
-
import typing as ta
|
6
|
-
|
7
|
-
from omlish.formats.toml.parser import toml_loads
|
8
|
-
from omlish.lite.check import check
|
9
|
-
from omlish.lite.marshal import OBJ_MARSHALER_MANAGER
|
10
|
-
from omlish.lite.marshal import ObjMarshalerManager
|
11
|
-
|
12
|
-
|
13
|
-
T = ta.TypeVar('T')
|
14
|
-
|
15
|
-
ConfigMapping = ta.Mapping[str, ta.Any]
|
16
|
-
|
17
|
-
|
18
|
-
##
|
19
|
-
|
20
|
-
|
21
|
-
def parse_config_file(
|
22
|
-
name: str,
|
23
|
-
f: ta.TextIO,
|
24
|
-
) -> ConfigMapping:
|
25
|
-
if name.endswith('.toml'):
|
26
|
-
return toml_loads(f.read())
|
27
|
-
|
28
|
-
elif any(name.endswith(e) for e in ('.yml', '.yaml')):
|
29
|
-
yaml = __import__('yaml')
|
30
|
-
return yaml.safe_load(f)
|
31
|
-
|
32
|
-
elif name.endswith('.ini'):
|
33
|
-
import configparser
|
34
|
-
cp = configparser.ConfigParser()
|
35
|
-
cp.read_file(f)
|
36
|
-
config_dct: ta.Dict[str, ta.Any] = {}
|
37
|
-
for sec in cp.sections():
|
38
|
-
cd = config_dct
|
39
|
-
for k in sec.split('.'):
|
40
|
-
cd = cd.setdefault(k, {})
|
41
|
-
cd.update(cp.items(sec))
|
42
|
-
return config_dct
|
43
|
-
|
44
|
-
else:
|
45
|
-
return json.loads(f.read())
|
46
|
-
|
47
|
-
|
48
|
-
def read_config_file(
|
49
|
-
path: str,
|
50
|
-
cls: ta.Type[T],
|
51
|
-
*,
|
52
|
-
prepare: ta.Optional[ta.Callable[[ConfigMapping], ConfigMapping]] = None,
|
53
|
-
msh: ObjMarshalerManager = OBJ_MARSHALER_MANAGER,
|
54
|
-
) -> T:
|
55
|
-
with open(path) as cf:
|
56
|
-
config_dct = parse_config_file(os.path.basename(path), cf)
|
57
|
-
|
58
|
-
if prepare is not None:
|
59
|
-
config_dct = prepare(config_dct)
|
60
|
-
|
61
|
-
return msh.unmarshal_obj(config_dct, cls)
|
62
|
-
|
63
|
-
|
64
|
-
##
|
65
|
-
|
66
|
-
|
67
|
-
def build_config_named_children(
|
68
|
-
o: ta.Union[
|
69
|
-
ta.Sequence[ConfigMapping],
|
70
|
-
ta.Mapping[str, ConfigMapping],
|
71
|
-
None,
|
72
|
-
],
|
73
|
-
*,
|
74
|
-
name_key: str = 'name',
|
75
|
-
) -> ta.Optional[ta.Sequence[ConfigMapping]]:
|
76
|
-
if o is None:
|
77
|
-
return None
|
78
|
-
|
79
|
-
lst: ta.List[ConfigMapping] = []
|
80
|
-
if isinstance(o, ta.Mapping):
|
81
|
-
for k, v in o.items():
|
82
|
-
check.isinstance(v, ta.Mapping)
|
83
|
-
if name_key in v:
|
84
|
-
n = v[name_key]
|
85
|
-
if k != n:
|
86
|
-
raise KeyError(f'Given names do not match: {n} != {k}')
|
87
|
-
lst.append(v)
|
88
|
-
else:
|
89
|
-
lst.append({name_key: k, **v})
|
90
|
-
|
91
|
-
else:
|
92
|
-
check.not_isinstance(o, str)
|
93
|
-
lst.extend(o)
|
94
|
-
|
95
|
-
seen = set()
|
96
|
-
for d in lst:
|
97
|
-
n = d['name']
|
98
|
-
if n in d:
|
99
|
-
raise KeyError(f'Duplicate name: {n}')
|
100
|
-
seen.add(n)
|
101
|
-
|
102
|
-
return lst
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|