ominfra 0.0.0.dev190__py3-none-any.whl → 0.0.0.dev192__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -6481,6 +6481,12 @@ class ServerConfig:
6481
6481
  # TODO: implement - make sure to accept broken symlinks
6482
6482
  group_config_dirs: ta.Optional[ta.Sequence[str]] = None
6483
6483
 
6484
+ #
6485
+
6486
+ http_port: ta.Optional[int] = None
6487
+
6488
+ #
6489
+
6484
6490
  @classmethod
6485
6491
  def new(
6486
6492
  cls,
@@ -8354,7 +8360,7 @@ class HttpServer(HasDispatchers):
8354
8360
  def __init__(
8355
8361
  self,
8356
8362
  handler: Handler,
8357
- addr: Address = Address(('localhost', 8000)),
8363
+ addr: Address, # = Address(('localhost', 8000)),
8358
8364
  *,
8359
8365
  exit_stack: contextlib.ExitStack,
8360
8366
  ) -> None:
@@ -9617,16 +9623,19 @@ def bind_server(
9617
9623
 
9618
9624
  #
9619
9625
 
9620
- def _provide_http_handler(s: SupervisorHttpHandler) -> HttpServer.Handler:
9621
- return HttpServer.Handler(s.handle)
9626
+ if config.http_port is not None:
9627
+ def _provide_http_handler(s: SupervisorHttpHandler) -> HttpServer.Handler:
9628
+ return HttpServer.Handler(s.handle)
9622
9629
 
9623
- lst.extend([
9624
- inj.bind(HttpServer, singleton=True, eager=True),
9625
- inj.bind(HasDispatchers, array=True, to_key=HttpServer),
9630
+ lst.extend([
9631
+ inj.bind(HttpServer, singleton=True, eager=True),
9632
+ inj.bind(HasDispatchers, array=True, to_key=HttpServer),
9626
9633
 
9627
- inj.bind(SupervisorHttpHandler, singleton=True),
9628
- inj.bind(_provide_http_handler),
9629
- ])
9634
+ inj.bind(HttpServer.Address(('localhost', config.http_port))),
9635
+
9636
+ inj.bind(SupervisorHttpHandler, singleton=True),
9637
+ inj.bind(_provide_http_handler),
9638
+ ])
9630
9639
 
9631
9640
  #
9632
9641
 
@@ -248,6 +248,12 @@ class ServerConfig:
248
248
  # TODO: implement - make sure to accept broken symlinks
249
249
  group_config_dirs: ta.Optional[ta.Sequence[str]] = None
250
250
 
251
+ #
252
+
253
+ http_port: ta.Optional[int] = None
254
+
255
+ #
256
+
251
257
  @classmethod
252
258
  def new(
253
259
  cls,
@@ -60,7 +60,7 @@ class HttpServer(HasDispatchers):
60
60
  def __init__(
61
61
  self,
62
62
  handler: Handler,
63
- addr: Address = Address(('localhost', 8000)),
63
+ addr: Address, # = Address(('localhost', 8000)),
64
64
  *,
65
65
  exit_stack: contextlib.ExitStack,
66
66
  ) -> None:
@@ -131,16 +131,19 @@ def bind_server(
131
131
 
132
132
  #
133
133
 
134
- def _provide_http_handler(s: SupervisorHttpHandler) -> HttpServer.Handler:
135
- return HttpServer.Handler(s.handle)
134
+ if config.http_port is not None:
135
+ def _provide_http_handler(s: SupervisorHttpHandler) -> HttpServer.Handler:
136
+ return HttpServer.Handler(s.handle)
136
137
 
137
- lst.extend([
138
- inj.bind(HttpServer, singleton=True, eager=True),
139
- inj.bind(HasDispatchers, array=True, to_key=HttpServer),
138
+ lst.extend([
139
+ inj.bind(HttpServer, singleton=True, eager=True),
140
+ inj.bind(HasDispatchers, array=True, to_key=HttpServer),
140
141
 
141
- inj.bind(SupervisorHttpHandler, singleton=True),
142
- inj.bind(_provide_http_handler),
143
- ])
142
+ inj.bind(HttpServer.Address(('localhost', config.http_port))),
143
+
144
+ inj.bind(SupervisorHttpHandler, singleton=True),
145
+ inj.bind(_provide_http_handler),
146
+ ])
144
147
 
145
148
  #
146
149
 
ominfra/systemd.py ADDED
@@ -0,0 +1,49 @@
1
+ # ruff: noqa: UP006 UP007
2
+ # @omlish-lite
3
+ import dataclasses as dc
4
+ import typing as ta
5
+
6
+
7
+ ##
8
+
9
+
10
+ @dc.dataclass(frozen=True)
11
+ class SystemdListUnit:
12
+ unit: str
13
+ load: str # loaded, not-found
14
+ active: str # active, inactive
15
+ sub: str # running, exited, dead
16
+ description: str
17
+
18
+ @classmethod
19
+ def parse(cls, s: str) -> 'SystemdListUnit':
20
+ return SystemdListUnit(*[p.strip() for p in s.strip().split(None, 4)])
21
+
22
+ @classmethod
23
+ def parse_all(cls, s: str) -> ta.List['SystemdListUnit']:
24
+ return [
25
+ cls.parse(sl)
26
+ for l in s.strip().splitlines()
27
+ if (sl := l.strip())
28
+ ]
29
+
30
+
31
+ PARSABLE_SYSTEMD_LIST_UNIT_ARGS: ta.Sequence[str] = [
32
+ '--all',
33
+ '--no-legend',
34
+ '--no-pager',
35
+ '--plain',
36
+ ]
37
+
38
+
39
+ ##
40
+
41
+
42
+ def parse_systemd_show_output(s: str) -> ta.Mapping[str, str]:
43
+ d: ta.Dict[str, str] = {}
44
+ for l in s.strip().splitlines():
45
+ if not (l := l.strip()):
46
+ continue
47
+ k, _, v = l.partition('=')
48
+ d[k] = v
49
+ return d
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ominfra
3
- Version: 0.0.0.dev190
3
+ Version: 0.0.0.dev192
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.dev190
16
- Requires-Dist: omlish==0.0.0.dev190
17
- Requires-Dist: omserv==0.0.0.dev190
15
+ Requires-Dist: omdev==0.0.0.dev192
16
+ Requires-Dist: omlish==0.0.0.dev192
17
+ Requires-Dist: omserv==0.0.0.dev192
18
18
  Provides-Extra: all
19
19
  Requires-Dist: paramiko~=3.5; extra == "all"
20
20
  Requires-Dist: asyncssh~=2.18; extra == "all"
@@ -5,6 +5,7 @@ ominfra/cmds.py,sha256=E0AfnvEmnKntXWvmLW5L05_NeDpBET1VBXn7vV6EwBQ,2083
5
5
  ominfra/configs.py,sha256=UrwZrzsnU4E305OoFH_eAcyI8e82LQZ2yhy8WnuAUGM,3055
6
6
  ominfra/pyremote.py,sha256=HLfAZl3Xw5CpxLS5PS380zqCyE7n3vKVksIYT2Fbdc8,15197
7
7
  ominfra/ssh.py,sha256=jQpc4WvkMckIfk4vILda8zFaeharRqc_6wxW50b0OjQ,5431
8
+ ominfra/systemd.py,sha256=d61NVrJoItzSaqhMDgKGrQjbrxEVAujUMDsj8WggXos,1022
8
9
  ominfra/threadworkers.py,sha256=oX4ubZn7h932saXpRIJu2MNhBExgGGMuGhdXarZxLJw,4948
9
10
  ominfra/clouds/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
11
  ominfra/clouds/aws/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -44,24 +45,24 @@ ominfra/manage/commands/ping.py,sha256=DVZFzL1Z_f-Bq53vxMrL3xOi0iK_nMonJE4KvQf9w
44
45
  ominfra/manage/commands/subprocess.py,sha256=yHGMbAI-xKe_9BUs5IZ3Yav8qRE-I9aGnBtTwW15Pnw,2440
45
46
  ominfra/manage/commands/types.py,sha256=XFZPeqeIBAaIIQF3pdPbGxLlb-LCrz6WtlDWO2q_vz0,210
46
47
  ominfra/manage/deploy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
47
- ominfra/manage/deploy/apps.py,sha256=cZmM3VgWlojKoGFAQN2Zzu5UkT_o7SXaoXg1iKdmFE8,3010
48
+ ominfra/manage/deploy/apps.py,sha256=T0eU0Jw-h33_ZPIs0zy9DOx_fgs3YSAAGzu-H0pvt2U,4865
48
49
  ominfra/manage/deploy/commands.py,sha256=OVZzSY4EP_SD7KJRkIIPeqUxcV4mcwrc_WYNvM16ahM,830
49
50
  ominfra/manage/deploy/config.py,sha256=kPpl8TRisz295cM4oj-RHA6oh5jdcJ_N9pVpkl_doO8,114
50
- ominfra/manage/deploy/deploy.py,sha256=qAae-MIsaebt1WuyT6vdYFDX6aLkuhDOesaCzMvpY1w,6041
51
- ominfra/manage/deploy/git.py,sha256=g4wzUuSu9HwWSDhdVX-7BvA2htMwtWbRcHaoDy-xOJ4,3960
51
+ ominfra/manage/deploy/deploy.py,sha256=YRr_0OPIZJ9LnOeMaHYCSSvqh81a5_LB7OZy-bR2GeA,8966
52
+ ominfra/manage/deploy/git.py,sha256=AnZCUuJt9infrWLAgxwELSEJVkDACNwQCen2Qi81-IA,4047
52
53
  ominfra/manage/deploy/inject.py,sha256=lVNik0CfQMd31fiqzFlM828oQKVUTJY-zTmU1pGOopQ,3467
53
54
  ominfra/manage/deploy/inject_.py,sha256=LR7gEkVx2ldUoQZsGvIcm1Y4QXCVDnLIAdc3LHhQiD4,392
54
55
  ominfra/manage/deploy/interp.py,sha256=_5fuHrY5ZA0eGbnNcOqAhAMSWI1UNvbm0l29eDjE5fI,1037
55
56
  ominfra/manage/deploy/nginx.py,sha256=cU9GjWMSxqeNhbuSBZYRuBXUokiRiY4OWMLAgbj_4m4,89
56
- ominfra/manage/deploy/specs.py,sha256=Bl0Fp1_loWZ3Y6gFGE9j_neTslaN4jMwFKHmoFcQixs,2629
57
- ominfra/manage/deploy/systemd.py,sha256=aDwm3Ly0I4qSZehInIGn_70RQvgdzUCSTfOTlhRmVrM,2765
58
- ominfra/manage/deploy/tags.py,sha256=3BU0OtHQJ1Vk9B_U7Q3Cq1rbVgxcXrFki24WU0nPX1M,5106
57
+ ominfra/manage/deploy/specs.py,sha256=0mZnMeMYLChcryXQhQ1V72zr8ooCWaw9AMvnPVJBZFE,2866
58
+ ominfra/manage/deploy/systemd.py,sha256=5hJ6d2zT24zBMUkuJwkhsvm7r4MqNBtm4_ov0kF2Jus,3612
59
+ ominfra/manage/deploy/tags.py,sha256=h2kJEmizzeKcn7hG-oKnakCquS87xw8EPb2nkB-XkaI,5118
59
60
  ominfra/manage/deploy/tmp.py,sha256=FqXoVpIpVe8-KWNu7kXt37A4jKdK_y7h_YFvtrUoOG8,729
60
61
  ominfra/manage/deploy/types.py,sha256=ZcIoheZ3zW7n0IZiqTRW_Uo3JyWWeWg5nyKGryvGc2I,112
61
- ominfra/manage/deploy/venvs.py,sha256=cwHapRRMioWvsYJL2-8SijTDOmiVoXIsOlunEIaIuVU,1532
62
+ ominfra/manage/deploy/venvs.py,sha256=PlvhyhZavgiSwGt8BXrhoSwQFVKpU0zCtq2C2N1_8Ak,1696
62
63
  ominfra/manage/deploy/conf/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
63
64
  ominfra/manage/deploy/conf/inject.py,sha256=xHZQr7oaJCxaKgpJ0H-hgiQNGt4QsskhT3f5v7xrFwE,451
64
- ominfra/manage/deploy/conf/manager.py,sha256=h8tJJv-ZfK5Jiw4xM-mbEoWolVUlq_ETsNqNhSzN9ag,6653
65
+ ominfra/manage/deploy/conf/manager.py,sha256=ZJPwLuly5Jwd6-42umv_hDNr3J86zNrZkNU-RuM0ees,8302
65
66
  ominfra/manage/deploy/conf/specs.py,sha256=AWeofV1YbcNZS-7WX7EpsX8i_7stJAXndXktB6fDWw8,2187
66
67
  ominfra/manage/deploy/paths/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
67
68
  ominfra/manage/deploy/paths/inject.py,sha256=X81C-Qhef1LQ7tILWvkomBwFTvgooLVmWRnKL7TeVoI,596
@@ -93,20 +94,20 @@ ominfra/manage/targets/inject.py,sha256=P4597xWM-V3I_gCt2O71OLhYQkkXtuJvkYRsIbhh
93
94
  ominfra/manage/targets/targets.py,sha256=7GP6UAZyJFEhpkJN6UQdpr_WN3p7C76v-s445y-WB6U,1885
94
95
  ominfra/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
95
96
  ominfra/scripts/journald2aws.py,sha256=jxBI2ETft-GMJn0hFwV_lZgT55tj2kqKl0PszxUkOg8,158938
96
- ominfra/scripts/manage.py,sha256=caUPUY6Re52MTbNCdsKLo_z2OAmZo81Dw_tVOpnQ1Ko,338592
97
- ominfra/scripts/supervisor.py,sha256=nFPSB-NGQeoHwAA5UCAvcgy6sUWh4UtuQbhVZShk7wI,283226
97
+ ominfra/scripts/manage.py,sha256=_C2fwegFHqx7OK0dfPZ631HwZHYfCYubi24sDHwSk4U,346082
98
+ ominfra/scripts/supervisor.py,sha256=5Nskq1fVdgwXvRXojDmkMO3JlcfQkxOwJ5vgexFi9EE,283429
98
99
  ominfra/supervisor/LICENSE.txt,sha256=yvqaMNsDhWxziHa9ien6qCW1SkZv-DQlAg96XjfSee8,1746
99
100
  ominfra/supervisor/__init__.py,sha256=Y3l4WY4JRi2uLG6kgbGp93fuGfkxkKwZDvhsa0Rwgtk,15
100
101
  ominfra/supervisor/__main__.py,sha256=I0yFw-C08OOiZ3BF6lF1Oiv789EQXu-_j6whDhQUTEA,66
101
- ominfra/supervisor/configs.py,sha256=UxcZ1yaw7CiwiSb7A1AegwcWKFXqtswaKaHlIN8Bt_Q,13771
102
+ ominfra/supervisor/configs.py,sha256=rA32edDnkfcUYSUPVRG4QIoGwCvnhstaNN2jTXvoqt4,13825
102
103
  ominfra/supervisor/dispatchers.py,sha256=zXLwQS4Vc6dWw5o9QOL04UMDt7w6CKu9wf19CjUiS2Q,1005
103
104
  ominfra/supervisor/dispatchersimpl.py,sha256=q3dEyOHWTPKm28nmAGisjgIW1BX6O3-SzbYa7nWuTEs,11349
104
105
  ominfra/supervisor/events.py,sha256=XGrtzHr1xm0dwjz329fn9eR0_Ap-LQL6Sk8LJ8eVDEo,6692
105
106
  ominfra/supervisor/exceptions.py,sha256=Qbu211H3CLlSmi9LsSikOwrcL5HgJP9ugvcKWlGTAoI,750
106
107
  ominfra/supervisor/groups.py,sha256=MBbsbt8Zh_WEYkGOr1KXa82gnPVw9wPB2lAnqhugXSc,2457
107
108
  ominfra/supervisor/groupsimpl.py,sha256=PCDyc_Wc-pnvIj56_aEyiA5exCpK6n9iErqnJzO2rZk,2281
108
- ominfra/supervisor/http.py,sha256=_5wiB0DpLzqsPTHn9DkWqhrNSVQSbbIiwsCuSEtosoM,3449
109
- ominfra/supervisor/inject.py,sha256=6nBEnpE8VLjtYK12z5DGRP7WzgbwLAz5yf__1KnJl6g,4693
109
+ ominfra/supervisor/http.py,sha256=Tl5eT6dyf4KuQXKbhGo1B6CFEzUDtPl_DZAuUFVD9zI,3453
110
+ ominfra/supervisor/inject.py,sha256=IeR-WKvK1sGNxMe6G2OBT5kSP7EUP5ipkDgcUFmDPCA,4838
110
111
  ominfra/supervisor/io.py,sha256=moaGNaPuYXEAUzLg8Qjo05DEIcOUNYUj8SSr8eT0d24,3198
111
112
  ominfra/supervisor/main.py,sha256=7YrreFNntdRCp6MplCclfnRcgrRIb_UCeohJkDC9Few,4251
112
113
  ominfra/supervisor/pipes.py,sha256=2ZihNTnRNjnIPOtPbm3_pyqO15f7BNs7WnNtO5V8ahM,2231
@@ -136,9 +137,9 @@ ominfra/tailscale/api.py,sha256=C5-t_b6jZXUWcy5k8bXm7CFnk73pSdrlMOgGDeGVrpw,1370
136
137
  ominfra/tailscale/cli.py,sha256=3FnJbgpLw6gInTfhERd1mDy9ijjMUGxkdYVo43Tnxx4,3555
137
138
  ominfra/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
138
139
  ominfra/tools/listresources.py,sha256=4qVg5txsb10EHhvqXXeM6gJ2jx9LbroEnPydDv1uXs0,6176
139
- ominfra-0.0.0.dev190.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
140
- ominfra-0.0.0.dev190.dist-info/METADATA,sha256=ZVC-MD5Jy8fZaChCJgEhJBQZ5JRqs_DVijPKgaJtwxs,767
141
- ominfra-0.0.0.dev190.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
142
- ominfra-0.0.0.dev190.dist-info/entry_points.txt,sha256=kgecQ2MgGrM9qK744BoKS3tMesaC3yjLnl9pa5CRczg,37
143
- ominfra-0.0.0.dev190.dist-info/top_level.txt,sha256=E-b2OHkk_AOBLXHYZQ2EOFKl-_6uOGd8EjeG-Zy6h_w,8
144
- ominfra-0.0.0.dev190.dist-info/RECORD,,
140
+ ominfra-0.0.0.dev192.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
141
+ ominfra-0.0.0.dev192.dist-info/METADATA,sha256=R7AOfKOeQacurgpdYE4zsQs9JRq0tCFHDEVItCCS5Lg,767
142
+ ominfra-0.0.0.dev192.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
143
+ ominfra-0.0.0.dev192.dist-info/entry_points.txt,sha256=kgecQ2MgGrM9qK744BoKS3tMesaC3yjLnl9pa5CRczg,37
144
+ ominfra-0.0.0.dev192.dist-info/top_level.txt,sha256=E-b2OHkk_AOBLXHYZQ2EOFKl-_6uOGd8EjeG-Zy6h_w,8
145
+ ominfra-0.0.0.dev192.dist-info/RECORD,,