ominfra 0.0.0.dev226__py3-none-any.whl → 0.0.0.dev228__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/clouds/aws/journald2aws/driver.py +1 -1
- ominfra/scripts/journald2aws.py +32 -12
- ominfra/scripts/manage.py +1 -1
- {ominfra-0.0.0.dev226.dist-info → ominfra-0.0.0.dev228.dist-info}/METADATA +3 -3
- {ominfra-0.0.0.dev226.dist-info → ominfra-0.0.0.dev228.dist-info}/RECORD +9 -9
- {ominfra-0.0.0.dev226.dist-info → ominfra-0.0.0.dev228.dist-info}/LICENSE +0 -0
- {ominfra-0.0.0.dev226.dist-info → ominfra-0.0.0.dev228.dist-info}/WHEEL +0 -0
- {ominfra-0.0.0.dev226.dist-info → ominfra-0.0.0.dev228.dist-info}/entry_points.txt +0 -0
- {ominfra-0.0.0.dev226.dist-info → ominfra-0.0.0.dev228.dist-info}/top_level.txt +0 -0
ominfra/scripts/journald2aws.py
CHANGED
@@ -2048,7 +2048,7 @@ class Pidfile:
|
|
2048
2048
|
del self._f
|
2049
2049
|
return True
|
2050
2050
|
|
2051
|
-
def
|
2051
|
+
def try_acquire_lock(self) -> bool:
|
2052
2052
|
try:
|
2053
2053
|
fcntl.flock(self._f, fcntl.LOCK_EX | fcntl.LOCK_NB)
|
2054
2054
|
return True
|
@@ -2056,14 +2056,29 @@ class Pidfile:
|
|
2056
2056
|
except OSError:
|
2057
2057
|
return False
|
2058
2058
|
|
2059
|
-
|
2060
|
-
|
2061
|
-
|
2059
|
+
#
|
2060
|
+
|
2061
|
+
class Error(Exception):
|
2062
|
+
pass
|
2063
|
+
|
2064
|
+
class LockedError(Error):
|
2065
|
+
pass
|
2066
|
+
|
2067
|
+
def acquire_lock(self) -> None:
|
2068
|
+
if not self.try_acquire_lock():
|
2069
|
+
raise self.LockedError
|
2070
|
+
|
2071
|
+
class NotLockedError(Error):
|
2072
|
+
pass
|
2073
|
+
|
2074
|
+
def ensure_cannot_lock(self) -> None:
|
2075
|
+
if self.try_acquire_lock():
|
2076
|
+
raise self.NotLockedError
|
2062
2077
|
|
2063
2078
|
#
|
2064
2079
|
|
2065
2080
|
def write(self, pid: ta.Optional[int] = None) -> None:
|
2066
|
-
self.
|
2081
|
+
self.acquire_lock()
|
2067
2082
|
|
2068
2083
|
if pid is None:
|
2069
2084
|
pid = os.getpid()
|
@@ -2074,20 +2089,25 @@ class Pidfile:
|
|
2074
2089
|
self._f.flush()
|
2075
2090
|
|
2076
2091
|
def clear(self) -> None:
|
2077
|
-
self.
|
2092
|
+
self.acquire_lock()
|
2078
2093
|
|
2079
2094
|
self._f.seek(0)
|
2080
2095
|
self._f.truncate()
|
2081
2096
|
|
2082
|
-
|
2083
|
-
|
2084
|
-
|
2097
|
+
#
|
2098
|
+
|
2099
|
+
def read(self) -> ta.Optional[int]:
|
2100
|
+
self.ensure_cannot_lock()
|
2085
2101
|
|
2086
2102
|
self._f.seek(0)
|
2087
|
-
|
2103
|
+
buf = self._f.read()
|
2104
|
+
if not buf:
|
2105
|
+
return None
|
2106
|
+
return int(buf)
|
2088
2107
|
|
2089
2108
|
def kill(self, sig: int = signal.SIGTERM) -> None:
|
2090
|
-
pid
|
2109
|
+
if (pid := self.read()) is None:
|
2110
|
+
raise self.Error(f'Pidfile locked but empty')
|
2091
2111
|
os.kill(pid, sig)
|
2092
2112
|
|
2093
2113
|
|
@@ -5044,7 +5064,7 @@ class JournalctlToAwsDriver(ExitStacked):
|
|
5044
5064
|
|
5045
5065
|
def _ensure_locked(self) -> None:
|
5046
5066
|
if (pf := self._pidfile()) is not None:
|
5047
|
-
pf.
|
5067
|
+
pf.acquire_lock()
|
5048
5068
|
|
5049
5069
|
#
|
5050
5070
|
|
ominfra/scripts/manage.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: ominfra
|
3
|
-
Version: 0.0.0.
|
3
|
+
Version: 0.0.0.dev228
|
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.dev228
|
16
|
+
Requires-Dist: omlish==0.0.0.dev228
|
17
17
|
Provides-Extra: all
|
18
18
|
Requires-Dist: paramiko~=3.5; extra == "all"
|
19
19
|
Requires-Dist: asyncssh~=2.18; extra == "all"
|
@@ -20,7 +20,7 @@ ominfra/clouds/aws/instancetypes/cli.py,sha256=HcfOchROLGFsxmEIuXtXVywFJWjHOk4yv
|
|
20
20
|
ominfra/clouds/aws/journald2aws/__init__.py,sha256=Y3l4WY4JRi2uLG6kgbGp93fuGfkxkKwZDvhsa0Rwgtk,15
|
21
21
|
ominfra/clouds/aws/journald2aws/__main__.py,sha256=d23loR_cKfTYZwYiqpt_CmKI7dd5WcYFgIYzqMep75E,68
|
22
22
|
ominfra/clouds/aws/journald2aws/cursor.py,sha256=tQ7O6BHlEdaalbiI_Rqagj0aHfdtTQ_ZJwdOSRUjNvQ,1173
|
23
|
-
ominfra/clouds/aws/journald2aws/driver.py,sha256=
|
23
|
+
ominfra/clouds/aws/journald2aws/driver.py,sha256=bq9NQ8oNn3XRVuGoe7sZwtu4jXZ6r3eytSAJBYUtMko,6119
|
24
24
|
ominfra/clouds/aws/journald2aws/main.py,sha256=sqs_IoLzadv0EJoWHnYdgg3bkDDSFshCvyRWByTm8Sg,2179
|
25
25
|
ominfra/clouds/aws/journald2aws/poster.py,sha256=hz1XuctW8GtLmfjhRvCFY6py52D4BzXHYny5XKFpHSA,2833
|
26
26
|
ominfra/clouds/aws/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -112,8 +112,8 @@ 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=
|
116
|
-
ominfra/scripts/manage.py,sha256=
|
115
|
+
ominfra/scripts/journald2aws.py,sha256=NUfhLpV9LFZeyQWNRkkCXYGMdPXyD2gj4F5PwDfxeDU,164683
|
116
|
+
ominfra/scripts/manage.py,sha256=rtTs5tm5RH9A6G6XgHSUi8bfWDkmpbPPx6TYoO_g-HM,373799
|
117
117
|
ominfra/scripts/supervisor.py,sha256=8vVoR8kq7Qh2z_NdOrDXXnNCu9N5TnOM2M5om4D-ZmA,296097
|
118
118
|
ominfra/supervisor/LICENSE.txt,sha256=ZrHY15PVR98y26Yg6iQfa-SXnUaYTDhrUsPVcEO5OKM,1874
|
119
119
|
ominfra/supervisor/__init__.py,sha256=Y3l4WY4JRi2uLG6kgbGp93fuGfkxkKwZDvhsa0Rwgtk,15
|
@@ -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=BxFoxtyF2aVEcW67ZD9QujoBkJBtvIxGmKqXvLwnEHo,6180
|
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.dev228.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
|
160
|
+
ominfra-0.0.0.dev228.dist-info/METADATA,sha256=wNNusTaDIEV9MjsbbramAvIJILZyVOaeqv66Bf7KfFg,731
|
161
|
+
ominfra-0.0.0.dev228.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
162
|
+
ominfra-0.0.0.dev228.dist-info/entry_points.txt,sha256=kgecQ2MgGrM9qK744BoKS3tMesaC3yjLnl9pa5CRczg,37
|
163
|
+
ominfra-0.0.0.dev228.dist-info/top_level.txt,sha256=E-b2OHkk_AOBLXHYZQ2EOFKl-_6uOGd8EjeG-Zy6h_w,8
|
164
|
+
ominfra-0.0.0.dev228.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|