ominfra 0.0.0.dev96__py3-none-any.whl → 0.0.0.dev97__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ominfra/.manifests.json +1 -1
- ominfra/tailscale/cli.py +17 -9
- {ominfra-0.0.0.dev96.dist-info → ominfra-0.0.0.dev97.dist-info}/METADATA +3 -3
- {ominfra-0.0.0.dev96.dist-info → ominfra-0.0.0.dev97.dist-info}/RECORD +8 -8
- {ominfra-0.0.0.dev96.dist-info → ominfra-0.0.0.dev97.dist-info}/LICENSE +0 -0
- {ominfra-0.0.0.dev96.dist-info → ominfra-0.0.0.dev97.dist-info}/WHEEL +0 -0
- {ominfra-0.0.0.dev96.dist-info → ominfra-0.0.0.dev97.dist-info}/entry_points.txt +0 -0
- {ominfra-0.0.0.dev96.dist-info → ominfra-0.0.0.dev97.dist-info}/top_level.txt +0 -0
ominfra/.manifests.json
CHANGED
ominfra/tailscale/cli.py
CHANGED
@@ -6,6 +6,7 @@ import typing as ta
|
|
6
6
|
from omdev.cli import CliModule
|
7
7
|
from omlish import argparse as ap
|
8
8
|
from omlish import cached
|
9
|
+
from omlish import check
|
9
10
|
from omlish import collections as col
|
10
11
|
from omlish import dataclasses as dc
|
11
12
|
from omlish import lang
|
@@ -16,6 +17,9 @@ from omlish.formats import json
|
|
16
17
|
##
|
17
18
|
|
18
19
|
|
20
|
+
_IP_V4_PAT = re.compile(r'\d{1,3}(\.\d{1,3}){3}')
|
21
|
+
|
22
|
+
|
19
23
|
@dc.dataclass(frozen=True)
|
20
24
|
@msh.update_object_metadata(field_naming=msh.Naming.CAMEL, unknown_field='x')
|
21
25
|
class CliNode:
|
@@ -27,6 +31,10 @@ class CliNode:
|
|
27
31
|
allowed_ips: ta.Sequence[str] | None = dc.xfield(None) | msh.update_field_metadata(name='AllowedPs')
|
28
32
|
tags: ta.Sequence[str] | None = None
|
29
33
|
|
34
|
+
@property
|
35
|
+
def ipv4s(self) -> ta.Sequence[str]:
|
36
|
+
return [i for i in self.tailscale_ips or () if _IP_V4_PAT.fullmatch(i)]
|
37
|
+
|
30
38
|
x: ta.Mapping[str, ta.Any] | None = None
|
31
39
|
|
32
40
|
|
@@ -56,9 +64,6 @@ class CliStatus:
|
|
56
64
|
##
|
57
65
|
|
58
66
|
|
59
|
-
_IP_V4_PAT = re.compile(r'\d{1,3}(\.\d{1,3}){3}')
|
60
|
-
|
61
|
-
|
62
67
|
class Cli(ap.Cli):
|
63
68
|
@lang.cached_function
|
64
69
|
def bin(self) -> str:
|
@@ -92,19 +97,22 @@ class Cli(ap.Cli):
|
|
92
97
|
out = status
|
93
98
|
print(json.dumps_pretty(msh.marshal(out)))
|
94
99
|
|
100
|
+
@ap.command()
|
101
|
+
def ips(self) -> None:
|
102
|
+
print(json.dumps_pretty({
|
103
|
+
hn: node.ipv4s
|
104
|
+
for hn, node in self.status().nodes_by_host_name.items()
|
105
|
+
}))
|
106
|
+
|
95
107
|
@ap.command(
|
96
108
|
ap.arg('name', nargs='?'),
|
97
109
|
)
|
98
110
|
def ip(self) -> None:
|
99
111
|
status = self.status()
|
100
|
-
ip_lists_by_hostname = {
|
101
|
-
hn: [i for i in node.tailscale_ips or () if _IP_V4_PAT.fullmatch(i)]
|
102
|
-
for hn, node in status.nodes_by_host_name.items()
|
103
|
-
}
|
104
112
|
if self.args.name:
|
105
|
-
print(
|
113
|
+
print(status.nodes_by_host_name[self.args.name].ipv4s[0])
|
106
114
|
else:
|
107
|
-
print(
|
115
|
+
print(check.not_none(status.self).ipv4s[0])
|
108
116
|
|
109
117
|
|
110
118
|
# @omlish-manifest
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ominfra
|
3
|
-
Version: 0.0.0.
|
3
|
+
Version: 0.0.0.dev97
|
4
4
|
Summary: ominfra
|
5
5
|
Author: wrmsr
|
6
6
|
License: BSD-3-Clause
|
@@ -12,8 +12,8 @@ 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.
|
15
|
+
Requires-Dist: omdev ==0.0.0.dev97
|
16
|
+
Requires-Dist: omlish ==0.0.0.dev97
|
17
17
|
Provides-Extra: all
|
18
18
|
Requires-Dist: paramiko ~=3.5 ; extra == 'all'
|
19
19
|
Requires-Dist: asyncssh ~=2.18 ; extra == 'all'
|
@@ -1,4 +1,4 @@
|
|
1
|
-
ominfra/.manifests.json,sha256=
|
1
|
+
ominfra/.manifests.json,sha256=8KREXxMAlsilZOktXPYru1ND3V5hFI22vnrp6hT3bio,589
|
2
2
|
ominfra/__about__.py,sha256=6i1AoruFYQCd-PyhhbDQDWY2d1tiQu9nkwWr-fXAqfY,705
|
3
3
|
ominfra/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
4
|
ominfra/cmds.py,sha256=E0AfnvEmnKntXWvmLW5L05_NeDpBET1VBXn7vV6EwBQ,2083
|
@@ -70,12 +70,12 @@ ominfra/supervisor/supervisor.py,sha256=eXmVKX-A3exX8yHmmJEhHVd-3VnjTtrfDCvV7EEb
|
|
70
70
|
ominfra/supervisor/types.py,sha256=ec62QG0CDJc0XNxCnf3lXxhsxrr4CCScLPI-1SpQjlc,1141
|
71
71
|
ominfra/tailscale/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
72
72
|
ominfra/tailscale/api.py,sha256=C5-t_b6jZXUWcy5k8bXm7CFnk73pSdrlMOgGDeGVrpw,1370
|
73
|
-
ominfra/tailscale/cli.py,sha256=
|
73
|
+
ominfra/tailscale/cli.py,sha256=DSGp4hn5xwOW-l_u_InKlSF6kIobxtUtVssf_73STs0,3567
|
74
74
|
ominfra/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
75
75
|
ominfra/tools/listresources.py,sha256=L4t5rszm9ulcdWyr7n48_R9d5Etg4S2a4WQhlbHDtnQ,6106
|
76
|
-
ominfra-0.0.0.
|
77
|
-
ominfra-0.0.0.
|
78
|
-
ominfra-0.0.0.
|
79
|
-
ominfra-0.0.0.
|
80
|
-
ominfra-0.0.0.
|
81
|
-
ominfra-0.0.0.
|
76
|
+
ominfra-0.0.0.dev97.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
|
77
|
+
ominfra-0.0.0.dev97.dist-info/METADATA,sha256=3X_wItrJ09jyjC93IuYSspq0DK2lX-8ojb_C11Z84Is,739
|
78
|
+
ominfra-0.0.0.dev97.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
|
79
|
+
ominfra-0.0.0.dev97.dist-info/entry_points.txt,sha256=kgecQ2MgGrM9qK744BoKS3tMesaC3yjLnl9pa5CRczg,37
|
80
|
+
ominfra-0.0.0.dev97.dist-info/top_level.txt,sha256=E-b2OHkk_AOBLXHYZQ2EOFKl-_6uOGd8EjeG-Zy6h_w,8
|
81
|
+
ominfra-0.0.0.dev97.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|