ominfra 0.0.0.dev189__py3-none-any.whl → 0.0.0.dev191__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
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.dev189
3
+ Version: 0.0.0.dev191
4
4
  Summary: ominfra
5
5
  Author: wrmsr
6
6
  License: BSD-3-Clause
@@ -12,8 +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.dev189
16
- Requires-Dist: omlish==0.0.0.dev189
15
+ Requires-Dist: omdev==0.0.0.dev191
16
+ Requires-Dist: omlish==0.0.0.dev191
17
+ Requires-Dist: omserv==0.0.0.dev191
17
18
  Provides-Extra: all
18
19
  Requires-Dist: paramiko~=3.5; extra == "all"
19
20
  Requires-Dist: asyncssh~=2.18; extra == "all"
@@ -1,10 +1,11 @@
1
1
  ominfra/.manifests.json,sha256=8KREXxMAlsilZOktXPYru1ND3V5hFI22vnrp6hT3bio,589
2
- ominfra/__about__.py,sha256=6i1AoruFYQCd-PyhhbDQDWY2d1tiQu9nkwWr-fXAqfY,705
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
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,29 +45,30 @@ 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=d0OwAVqLyr-_lrsmaeTH69G4b6vIm6ESvmWqKjA-Xn0,4750
48
- ominfra/manage/deploy/commands.py,sha256=U74HYQ4nhvH7znAKyXGOmZfdnll2gMWxKWVW4GzxG-0,830
48
+ ominfra/manage/deploy/apps.py,sha256=yvzY40Tk3dtNpIaqabyAxcm2LyE4UD3sI9pH64UaWek,4557
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=vyBTbBm51HhRE-MQNvxEt39F8uOYsB4ToqZ3zmVkpqU,819
51
- ominfra/manage/deploy/driver.py,sha256=kSriXFC8L_EpOcHFGxNZDBGyxV_fZAAF95y-czisnwE,1352
51
+ ominfra/manage/deploy/deploy.py,sha256=JXyeO0ZukcJYzMkY4h9wO2pKVzkfzgKZReuHWi_qS0w,8713
52
52
  ominfra/manage/deploy/git.py,sha256=g4wzUuSu9HwWSDhdVX-7BvA2htMwtWbRcHaoDy-xOJ4,3960
53
- ominfra/manage/deploy/inject.py,sha256=8Y1wUEnWCFh9a7YEzHi1GaPfK18c6wP6eVVkKKheScw,3378
53
+ ominfra/manage/deploy/inject.py,sha256=lVNik0CfQMd31fiqzFlM828oQKVUTJY-zTmU1pGOopQ,3467
54
54
  ominfra/manage/deploy/inject_.py,sha256=LR7gEkVx2ldUoQZsGvIcm1Y4QXCVDnLIAdc3LHhQiD4,392
55
55
  ominfra/manage/deploy/interp.py,sha256=_5fuHrY5ZA0eGbnNcOqAhAMSWI1UNvbm0l29eDjE5fI,1037
56
- ominfra/manage/deploy/specs.py,sha256=-WSVpRwiwgXVUh4HVdFUYxadxbLz1WX1ARmQXvmbLlw,2445
57
- ominfra/manage/deploy/tags.py,sha256=3BU0OtHQJ1Vk9B_U7Q3Cq1rbVgxcXrFki24WU0nPX1M,5106
56
+ ominfra/manage/deploy/nginx.py,sha256=cU9GjWMSxqeNhbuSBZYRuBXUokiRiY4OWMLAgbj_4m4,89
57
+ ominfra/manage/deploy/specs.py,sha256=1N1HHx_956sap4rFihsK6u71f0wGqn-eDaXrTkJkBeA,2819
58
+ ominfra/manage/deploy/systemd.py,sha256=MIb8RWljBgJ22WXMlapzLYBVrYJtD04G3pI297GIFD0,3556
59
+ ominfra/manage/deploy/tags.py,sha256=h2kJEmizzeKcn7hG-oKnakCquS87xw8EPb2nkB-XkaI,5118
58
60
  ominfra/manage/deploy/tmp.py,sha256=FqXoVpIpVe8-KWNu7kXt37A4jKdK_y7h_YFvtrUoOG8,729
59
61
  ominfra/manage/deploy/types.py,sha256=ZcIoheZ3zW7n0IZiqTRW_Uo3JyWWeWg5nyKGryvGc2I,112
60
- ominfra/manage/deploy/venvs.py,sha256=1Ic3yKap9bTduqHorz1MpmSiQPh9x-vxhLLxgpVpRdc,1592
62
+ ominfra/manage/deploy/venvs.py,sha256=PlvhyhZavgiSwGt8BXrhoSwQFVKpU0zCtq2C2N1_8Ak,1696
61
63
  ominfra/manage/deploy/conf/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
62
64
  ominfra/manage/deploy/conf/inject.py,sha256=xHZQr7oaJCxaKgpJ0H-hgiQNGt4QsskhT3f5v7xrFwE,451
63
- ominfra/manage/deploy/conf/manager.py,sha256=29txtcAeRNUqK2MD1V5Q-82EoeExdkkV4fRvPnc8GTs,6226
64
- ominfra/manage/deploy/conf/specs.py,sha256=r9Tf6i0TPVOTuoS__F5Yz1v14Btfqtb1nvUdgEaNeBU,2030
65
+ ominfra/manage/deploy/conf/manager.py,sha256=fwuMnH-1Iou3Zwz5lcM70F5dyULueAl-lzDKvGTbsCk,8084
66
+ ominfra/manage/deploy/conf/specs.py,sha256=AWeofV1YbcNZS-7WX7EpsX8i_7stJAXndXktB6fDWw8,2187
65
67
  ominfra/manage/deploy/paths/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
66
68
  ominfra/manage/deploy/paths/inject.py,sha256=X81C-Qhef1LQ7tILWvkomBwFTvgooLVmWRnKL7TeVoI,596
67
69
  ominfra/manage/deploy/paths/manager.py,sha256=Dnl8euyZQYDGwDzkMvgPAwOssseducr5kP6T0qzVXQk,929
68
70
  ominfra/manage/deploy/paths/owners.py,sha256=sgCdKOFve8XZOtoTjrFrOrJd_MhZOGXo4yFJAFGRQ_s,1229
69
- ominfra/manage/deploy/paths/paths.py,sha256=i7g8YdYOh4M_jgJXtafTbFkRhlu469cfGxAJAuB3fVY,5531
71
+ ominfra/manage/deploy/paths/paths.py,sha256=Slh6_ts77c4VVgyOt8GmIBMRz-rKsTnuKaaIYUGNwFY,5637
70
72
  ominfra/manage/deploy/paths/specs.py,sha256=0cXJI7xjevv4qco3qn4jAs9i5pGyupJ3CFAyJh8y1z0,244
71
73
  ominfra/manage/deploy/paths/types.py,sha256=TGgtSASmdyuZ2maZnvahfA0QxPLWlHBtpDeIEoEDGxk,112
72
74
  ominfra/manage/remote/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -92,7 +94,7 @@ ominfra/manage/targets/inject.py,sha256=P4597xWM-V3I_gCt2O71OLhYQkkXtuJvkYRsIbhh
92
94
  ominfra/manage/targets/targets.py,sha256=7GP6UAZyJFEhpkJN6UQdpr_WN3p7C76v-s445y-WB6U,1885
93
95
  ominfra/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
94
96
  ominfra/scripts/journald2aws.py,sha256=jxBI2ETft-GMJn0hFwV_lZgT55tj2kqKl0PszxUkOg8,158938
95
- ominfra/scripts/manage.py,sha256=ZH8YdqXxnFdcGb6uCcXotg2wbke0MnniRquPwy3aAPg,330216
97
+ ominfra/scripts/manage.py,sha256=sWdkSTm4Q3JinJn7MJSIXTk5FA2xh5I5k4U-ru-97RA,345127
96
98
  ominfra/scripts/supervisor.py,sha256=nFPSB-NGQeoHwAA5UCAvcgy6sUWh4UtuQbhVZShk7wI,283226
97
99
  ominfra/supervisor/LICENSE.txt,sha256=yvqaMNsDhWxziHa9ien6qCW1SkZv-DQlAg96XjfSee8,1746
98
100
  ominfra/supervisor/__init__.py,sha256=Y3l4WY4JRi2uLG6kgbGp93fuGfkxkKwZDvhsa0Rwgtk,15
@@ -135,9 +137,9 @@ ominfra/tailscale/api.py,sha256=C5-t_b6jZXUWcy5k8bXm7CFnk73pSdrlMOgGDeGVrpw,1370
135
137
  ominfra/tailscale/cli.py,sha256=3FnJbgpLw6gInTfhERd1mDy9ijjMUGxkdYVo43Tnxx4,3555
136
138
  ominfra/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
137
139
  ominfra/tools/listresources.py,sha256=4qVg5txsb10EHhvqXXeM6gJ2jx9LbroEnPydDv1uXs0,6176
138
- ominfra-0.0.0.dev189.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
139
- ominfra-0.0.0.dev189.dist-info/METADATA,sha256=K1IyNVwLsqPQnlgoLaBP-RbX8GE_N7nbSgtGPNJM89M,731
140
- ominfra-0.0.0.dev189.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
141
- ominfra-0.0.0.dev189.dist-info/entry_points.txt,sha256=kgecQ2MgGrM9qK744BoKS3tMesaC3yjLnl9pa5CRczg,37
142
- ominfra-0.0.0.dev189.dist-info/top_level.txt,sha256=E-b2OHkk_AOBLXHYZQ2EOFKl-_6uOGd8EjeG-Zy6h_w,8
143
- ominfra-0.0.0.dev189.dist-info/RECORD,,
140
+ ominfra-0.0.0.dev191.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
141
+ ominfra-0.0.0.dev191.dist-info/METADATA,sha256=88HCm4Rj1RAfAyjlC5T8wpwxPcfiy_kieXZBY5bUM0E,767
142
+ ominfra-0.0.0.dev191.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
143
+ ominfra-0.0.0.dev191.dist-info/entry_points.txt,sha256=kgecQ2MgGrM9qK744BoKS3tMesaC3yjLnl9pa5CRczg,37
144
+ ominfra-0.0.0.dev191.dist-info/top_level.txt,sha256=E-b2OHkk_AOBLXHYZQ2EOFKl-_6uOGd8EjeG-Zy6h_w,8
145
+ ominfra-0.0.0.dev191.dist-info/RECORD,,
@@ -1,62 +0,0 @@
1
- # ruff: noqa: UP006 UP007
2
- import typing as ta
3
-
4
- from omlish.lite.typing import Func1
5
-
6
- from .apps import DeployAppManager
7
- from .paths.manager import DeployPathsManager
8
- from .specs import DeploySpec
9
- from .tags import DeployAppRev
10
- from .tags import DeployTagMap
11
- from .tags import DeployTime
12
- from .types import DeployHome
13
-
14
-
15
- class DeployDriverFactory(Func1[DeploySpec, ta.ContextManager['DeployDriver']]):
16
- pass
17
-
18
-
19
- class DeployDriver:
20
- def __init__(
21
- self,
22
- *,
23
- spec: DeploySpec,
24
- home: DeployHome,
25
- time: DeployTime,
26
-
27
- paths: DeployPathsManager,
28
- apps: DeployAppManager,
29
- ) -> None:
30
- super().__init__()
31
-
32
- self._spec = spec
33
- self._home = home
34
- self._time = time
35
-
36
- self._paths = paths
37
- self._apps = apps
38
-
39
- async def drive_deploy(self) -> None:
40
- self._paths.validate_deploy_paths()
41
-
42
- #
43
-
44
- deploy_tags = DeployTagMap(
45
- self._time,
46
- self._spec.key(),
47
- )
48
-
49
- #
50
-
51
- for app in self._spec.apps:
52
- app_tags = deploy_tags.add(
53
- app.app,
54
- app.key(),
55
- DeployAppRev(app.git.rev),
56
- )
57
-
58
- await self._apps.prepare_app(
59
- app,
60
- self._home,
61
- app_tags,
62
- )