ominfra 0.0.0.dev245__py3-none-any.whl → 0.0.0.dev247__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/scripts/journald2aws.py +20 -4
- ominfra/scripts/supervisor.py +16 -0
- {ominfra-0.0.0.dev245.dist-info → ominfra-0.0.0.dev247.dist-info}/METADATA +3 -3
- {ominfra-0.0.0.dev245.dist-info → ominfra-0.0.0.dev247.dist-info}/RECORD +8 -8
- {ominfra-0.0.0.dev245.dist-info → ominfra-0.0.0.dev247.dist-info}/LICENSE +0 -0
- {ominfra-0.0.0.dev245.dist-info → ominfra-0.0.0.dev247.dist-info}/WHEEL +0 -0
- {ominfra-0.0.0.dev245.dist-info → ominfra-0.0.0.dev247.dist-info}/entry_points.txt +0 -0
- {ominfra-0.0.0.dev245.dist-info → ominfra-0.0.0.dev247.dist-info}/top_level.txt +0 -0
ominfra/scripts/journald2aws.py
CHANGED
@@ -1946,6 +1946,7 @@ class ProxyLogHandler(ProxyLogFilterer, logging.Handler):
|
|
1946
1946
|
"""
|
1947
1947
|
TODO:
|
1948
1948
|
- 'json pids', with code version? '.json.pid'? '.jpid'?
|
1949
|
+
- json*L* pidfiles - first line is bare int, following may be json - now `head -n1 foo.pid` not cat
|
1949
1950
|
"""
|
1950
1951
|
|
1951
1952
|
|
@@ -2091,7 +2092,12 @@ class Pidfile:
|
|
2091
2092
|
|
2092
2093
|
#
|
2093
2094
|
|
2094
|
-
def write(
|
2095
|
+
def write(
|
2096
|
+
self,
|
2097
|
+
pid: ta.Optional[int] = None,
|
2098
|
+
*,
|
2099
|
+
suffix: ta.Optional[str] = None,
|
2100
|
+
) -> None:
|
2095
2101
|
self.acquire_lock()
|
2096
2102
|
|
2097
2103
|
if pid is None:
|
@@ -2099,7 +2105,11 @@ class Pidfile:
|
|
2099
2105
|
|
2100
2106
|
self._f.seek(0)
|
2101
2107
|
self._f.truncate()
|
2102
|
-
self._f.write(
|
2108
|
+
self._f.write('\n'.join([
|
2109
|
+
str(pid),
|
2110
|
+
*([suffix] if suffix is not None else []),
|
2111
|
+
'',
|
2112
|
+
]))
|
2103
2113
|
self._f.flush()
|
2104
2114
|
|
2105
2115
|
def clear(self) -> None:
|
@@ -2110,14 +2120,20 @@ class Pidfile:
|
|
2110
2120
|
|
2111
2121
|
#
|
2112
2122
|
|
2113
|
-
def
|
2123
|
+
def read_raw(self) -> ta.Optional[str]:
|
2114
2124
|
self.ensure_cannot_lock()
|
2115
2125
|
|
2116
2126
|
self._f.seek(0)
|
2117
2127
|
buf = self._f.read()
|
2118
2128
|
if not buf:
|
2119
2129
|
return None
|
2120
|
-
return
|
2130
|
+
return buf
|
2131
|
+
|
2132
|
+
def read(self) -> ta.Optional[int]:
|
2133
|
+
buf = self.read_raw()
|
2134
|
+
if not buf:
|
2135
|
+
return None
|
2136
|
+
return int(buf.splitlines()[0].strip())
|
2121
2137
|
|
2122
2138
|
def kill(self, sig: int = signal.SIGTERM) -> None:
|
2123
2139
|
if (pid := self.read()) is None:
|
ominfra/scripts/supervisor.py
CHANGED
@@ -6849,6 +6849,22 @@ class LoggingHttpHandler(HttpHandler_):
|
|
6849
6849
|
return resp
|
6850
6850
|
|
6851
6851
|
|
6852
|
+
@dc.dataclass(frozen=True)
|
6853
|
+
class ExceptionLoggingHttpHandler(HttpHandler_):
|
6854
|
+
handler: HttpHandler
|
6855
|
+
log: logging.Logger
|
6856
|
+
message: ta.Union[str, ta.Callable[[HttpHandlerRequest, BaseException], str]] = 'Error in http handler'
|
6857
|
+
|
6858
|
+
def __call__(self, req: HttpHandlerRequest) -> HttpHandlerResponse:
|
6859
|
+
try:
|
6860
|
+
return self.handler(req)
|
6861
|
+
except Exception as e: # noqa
|
6862
|
+
if callable(msg := self.message):
|
6863
|
+
msg = msg(req, e)
|
6864
|
+
self.log.exception(msg)
|
6865
|
+
raise
|
6866
|
+
|
6867
|
+
|
6852
6868
|
##
|
6853
6869
|
|
6854
6870
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: ominfra
|
3
|
-
Version: 0.0.0.
|
3
|
+
Version: 0.0.0.dev247
|
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.dev247
|
16
|
+
Requires-Dist: omlish==0.0.0.dev247
|
17
17
|
Provides-Extra: all
|
18
18
|
Requires-Dist: paramiko~=3.5; extra == "all"
|
19
19
|
Requires-Dist: asyncssh~=2.18; extra == "all"
|
@@ -112,9 +112,9 @@ ominfra/manage/targets/connection.py,sha256=rVI1YJxFClcF-sdttqWyIz9_XjPI01GUdwxY
|
|
112
112
|
ominfra/manage/targets/inject.py,sha256=P4597xWM-V3I_gCt2O71OLhYQkkXtuJvkYRsIbhhMcE,1561
|
113
113
|
ominfra/manage/targets/targets.py,sha256=7GP6UAZyJFEhpkJN6UQdpr_WN3p7C76v-s445y-WB6U,1885
|
114
114
|
ominfra/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
115
|
-
ominfra/scripts/journald2aws.py,sha256=
|
115
|
+
ominfra/scripts/journald2aws.py,sha256=KDybsFOnwMboKRSTReml10Y6dw2LRH8FRlJ4ALnASlY,167994
|
116
116
|
ominfra/scripts/manage.py,sha256=2uU_QU9C6s1DiLz9wV_zLkfWNZZ91MZHiCIjuKLqDJw,378202
|
117
|
-
ominfra/scripts/supervisor.py,sha256=
|
117
|
+
ominfra/scripts/supervisor.py,sha256=Yp6as-xmawttOq6O69Dji3w4XNcWp9a5wpKqsQ33-pc,296866
|
118
118
|
ominfra/supervisor/LICENSE.txt,sha256=ZrHY15PVR98y26Yg6iQfa-SXnUaYTDhrUsPVcEO5OKM,1874
|
119
119
|
ominfra/supervisor/__init__.py,sha256=Y3l4WY4JRi2uLG6kgbGp93fuGfkxkKwZDvhsa0Rwgtk,15
|
120
120
|
ominfra/supervisor/__main__.py,sha256=I0yFw-C08OOiZ3BF6lF1Oiv789EQXu-_j6whDhQUTEA,66
|
@@ -156,9 +156,9 @@ ominfra/tailscale/api.py,sha256=C5-t_b6jZXUWcy5k8bXm7CFnk73pSdrlMOgGDeGVrpw,1370
|
|
156
156
|
ominfra/tailscale/cli.py,sha256=3FnJbgpLw6gInTfhERd1mDy9ijjMUGxkdYVo43Tnxx4,3555
|
157
157
|
ominfra/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
158
158
|
ominfra/tools/listresources.py,sha256=auGP1LlbBJSFKUWNvQo_UzA8IsBNZBTMwEkFFRJ4FX4,6185
|
159
|
-
ominfra-0.0.0.
|
160
|
-
ominfra-0.0.0.
|
161
|
-
ominfra-0.0.0.
|
162
|
-
ominfra-0.0.0.
|
163
|
-
ominfra-0.0.0.
|
164
|
-
ominfra-0.0.0.
|
159
|
+
ominfra-0.0.0.dev247.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
|
160
|
+
ominfra-0.0.0.dev247.dist-info/METADATA,sha256=ipU1cQanDAH5HyD-ISBZjVBDIcHbQbVlOr2yj60KUKU,731
|
161
|
+
ominfra-0.0.0.dev247.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
|
162
|
+
ominfra-0.0.0.dev247.dist-info/entry_points.txt,sha256=kgecQ2MgGrM9qK744BoKS3tMesaC3yjLnl9pa5CRczg,37
|
163
|
+
ominfra-0.0.0.dev247.dist-info/top_level.txt,sha256=E-b2OHkk_AOBLXHYZQ2EOFKl-_6uOGd8EjeG-Zy6h_w,8
|
164
|
+
ominfra-0.0.0.dev247.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|