ominfra 0.0.0.dev160__tar.gz → 0.0.0.dev161__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. {ominfra-0.0.0.dev160/ominfra.egg-info → ominfra-0.0.0.dev161}/PKG-INFO +3 -3
  2. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/deploy/git.py +2 -2
  3. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/deploy/inject.py +2 -2
  4. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/deploy/tmp.py +9 -9
  5. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/deploy/venvs.py +2 -2
  6. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/targets/connection.py +1 -1
  7. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/scripts/manage.py +208 -211
  8. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161/ominfra.egg-info}/PKG-INFO +3 -3
  9. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra.egg-info/SOURCES.txt +0 -1
  10. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra.egg-info/requires.txt +2 -2
  11. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/pyproject.toml +3 -3
  12. ominfra-0.0.0.dev160/ominfra/manage/deploy/atomics.py +0 -207
  13. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/LICENSE +0 -0
  14. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/MANIFEST.in +0 -0
  15. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/README.rst +0 -0
  16. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/.manifests.json +0 -0
  17. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/__about__.py +0 -0
  18. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/__init__.py +0 -0
  19. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/clouds/__init__.py +0 -0
  20. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/clouds/aws/__init__.py +0 -0
  21. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/clouds/aws/__main__.py +0 -0
  22. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/clouds/aws/auth.py +0 -0
  23. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/clouds/aws/cli.py +0 -0
  24. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/clouds/aws/dataclasses.py +0 -0
  25. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/clouds/aws/journald2aws/__init__.py +0 -0
  26. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/clouds/aws/journald2aws/__main__.py +0 -0
  27. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/clouds/aws/journald2aws/cursor.py +0 -0
  28. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/clouds/aws/journald2aws/driver.py +0 -0
  29. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/clouds/aws/journald2aws/main.py +0 -0
  30. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/clouds/aws/journald2aws/poster.py +0 -0
  31. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/clouds/aws/logs.py +0 -0
  32. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/clouds/aws/metadata.py +0 -0
  33. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/clouds/gcp/__init__.py +0 -0
  34. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/clouds/gcp/auth.py +0 -0
  35. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/cmds.py +0 -0
  36. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/configs.py +0 -0
  37. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/journald/__init__.py +0 -0
  38. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/journald/fields.py +0 -0
  39. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/journald/genmessages.py +0 -0
  40. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/journald/messages.py +0 -0
  41. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/journald/tailer.py +0 -0
  42. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/__init__.py +0 -0
  43. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/__main__.py +0 -0
  44. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/bootstrap.py +0 -0
  45. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/bootstrap_.py +0 -0
  46. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/commands/__init__.py +0 -0
  47. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/commands/base.py +0 -0
  48. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/commands/inject.py +0 -0
  49. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/commands/local.py +0 -0
  50. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/commands/marshal.py +0 -0
  51. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/commands/ping.py +0 -0
  52. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/commands/subprocess.py +0 -0
  53. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/commands/types.py +0 -0
  54. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/config.py +0 -0
  55. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/deploy/__init__.py +0 -0
  56. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/deploy/apps.py +0 -0
  57. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/deploy/commands.py +0 -0
  58. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/deploy/config.py +0 -0
  59. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/deploy/interp.py +0 -0
  60. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/deploy/paths.py +0 -0
  61. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/deploy/specs.py +0 -0
  62. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/deploy/types.py +0 -0
  63. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/inject.py +0 -0
  64. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/main.py +0 -0
  65. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/marshal.py +0 -0
  66. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/remote/__init__.py +0 -0
  67. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/remote/_main.py +0 -0
  68. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/remote/channel.py +0 -0
  69. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/remote/config.py +0 -0
  70. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/remote/connection.py +0 -0
  71. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/remote/execution.py +0 -0
  72. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/remote/inject.py +0 -0
  73. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/remote/payload.py +0 -0
  74. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/remote/spawning.py +0 -0
  75. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/system/__init__.py +0 -0
  76. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/system/commands.py +0 -0
  77. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/system/config.py +0 -0
  78. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/system/inject.py +0 -0
  79. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/system/packages.py +0 -0
  80. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/system/platforms.py +0 -0
  81. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/targets/__init__.py +0 -0
  82. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/targets/inject.py +0 -0
  83. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/manage/targets/targets.py +0 -0
  84. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/pyremote.py +0 -0
  85. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/scripts/__init__.py +0 -0
  86. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/scripts/journald2aws.py +0 -0
  87. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/scripts/supervisor.py +0 -0
  88. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/ssh.py +0 -0
  89. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/supervisor/LICENSE.txt +0 -0
  90. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/supervisor/__init__.py +0 -0
  91. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/supervisor/__main__.py +0 -0
  92. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/supervisor/configs.py +0 -0
  93. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/supervisor/dispatchers.py +0 -0
  94. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/supervisor/dispatchersimpl.py +0 -0
  95. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/supervisor/events.py +0 -0
  96. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/supervisor/exceptions.py +0 -0
  97. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/supervisor/groups.py +0 -0
  98. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/supervisor/groupsimpl.py +0 -0
  99. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/supervisor/http.py +0 -0
  100. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/supervisor/inject.py +0 -0
  101. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/supervisor/io.py +0 -0
  102. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/supervisor/main.py +0 -0
  103. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/supervisor/pipes.py +0 -0
  104. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/supervisor/privileges.py +0 -0
  105. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/supervisor/process.py +0 -0
  106. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/supervisor/processimpl.py +0 -0
  107. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/supervisor/setup.py +0 -0
  108. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/supervisor/setupimpl.py +0 -0
  109. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/supervisor/signals.py +0 -0
  110. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/supervisor/spawning.py +0 -0
  111. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/supervisor/spawningimpl.py +0 -0
  112. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/supervisor/states.py +0 -0
  113. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/supervisor/supervisor.py +0 -0
  114. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/supervisor/types.py +0 -0
  115. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/supervisor/utils/__init__.py +0 -0
  116. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/supervisor/utils/collections.py +0 -0
  117. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/supervisor/utils/diag.py +0 -0
  118. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/supervisor/utils/fds.py +0 -0
  119. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/supervisor/utils/fs.py +0 -0
  120. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/supervisor/utils/os.py +0 -0
  121. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/supervisor/utils/ostypes.py +0 -0
  122. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/supervisor/utils/signals.py +0 -0
  123. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/supervisor/utils/strings.py +0 -0
  124. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/supervisor/utils/users.py +0 -0
  125. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/tailscale/__init__.py +0 -0
  126. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/tailscale/api.py +0 -0
  127. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/tailscale/cli.py +0 -0
  128. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/threadworkers.py +0 -0
  129. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/tools/__init__.py +0 -0
  130. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra/tools/listresources.py +0 -0
  131. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra.egg-info/dependency_links.txt +0 -0
  132. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra.egg-info/entry_points.txt +0 -0
  133. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/ominfra.egg-info/top_level.txt +0 -0
  134. {ominfra-0.0.0.dev160 → ominfra-0.0.0.dev161}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ominfra
3
- Version: 0.0.0.dev160
3
+ Version: 0.0.0.dev161
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.dev160
16
- Requires-Dist: omlish==0.0.0.dev160
15
+ Requires-Dist: omdev==0.0.0.dev161
16
+ Requires-Dist: omlish==0.0.0.dev161
17
17
  Provides-Extra: all
18
18
  Requires-Dist: paramiko~=3.5; extra == "all"
19
19
  Requires-Dist: asyncssh~=2.18; extra == "all"
@@ -15,8 +15,8 @@ import typing as ta
15
15
  from omlish.asyncs.asyncio.subprocesses import asyncio_subprocesses
16
16
  from omlish.lite.cached import async_cached_nullary
17
17
  from omlish.lite.check import check
18
+ from omlish.os.atomics import AtomicPathSwapping
18
19
 
19
- from .atomics import DeployAtomicPathSwapping
20
20
  from .paths import SingleDirDeployPathOwner
21
21
  from .specs import DeployGitCheckout
22
22
  from .specs import DeployGitRepo
@@ -32,7 +32,7 @@ class DeployGitManager(SingleDirDeployPathOwner):
32
32
  self,
33
33
  *,
34
34
  deploy_home: ta.Optional[DeployHome] = None,
35
- atomics: DeployAtomicPathSwapping,
35
+ atomics: AtomicPathSwapping,
36
36
  ) -> None:
37
37
  super().__init__(
38
38
  owned_dir='git',
@@ -5,10 +5,10 @@ import typing as ta
5
5
  from omlish.lite.inject import InjectorBindingOrBindings
6
6
  from omlish.lite.inject import InjectorBindings
7
7
  from omlish.lite.inject import inj
8
+ from omlish.os.atomics import AtomicPathSwapping
8
9
 
9
10
  from ..commands.inject import bind_command
10
11
  from .apps import DeployAppManager
11
- from .atomics import DeployAtomicPathSwapping
12
12
  from .commands import DeployCommand
13
13
  from .commands import DeployCommandExecutor
14
14
  from .config import DeployConfig
@@ -34,7 +34,7 @@ def bind_deploy(
34
34
  inj.bind(DeployGitManager, singleton=True),
35
35
 
36
36
  inj.bind(DeployTmpManager, singleton=True),
37
- inj.bind(DeployAtomicPathSwapping, to_key=DeployTmpManager),
37
+ inj.bind(AtomicPathSwapping, to_key=DeployTmpManager),
38
38
 
39
39
  inj.bind(DeployVenvManager, singleton=True),
40
40
 
@@ -3,18 +3,18 @@ import typing as ta
3
3
 
4
4
  from omlish.lite.cached import cached_nullary
5
5
  from omlish.lite.check import check
6
+ from omlish.os.atomics import AtomicPathSwap
7
+ from omlish.os.atomics import AtomicPathSwapKind
8
+ from omlish.os.atomics import AtomicPathSwapping
9
+ from omlish.os.atomics import TempDirAtomicPathSwapping
6
10
 
7
- from .atomics import DeployAtomicPathSwap
8
- from .atomics import DeployAtomicPathSwapKind
9
- from .atomics import DeployAtomicPathSwapping
10
- from .atomics import TempDirDeployAtomicPathSwapping
11
11
  from .paths import SingleDirDeployPathOwner
12
12
  from .types import DeployHome
13
13
 
14
14
 
15
15
  class DeployTmpManager(
16
16
  SingleDirDeployPathOwner,
17
- DeployAtomicPathSwapping,
17
+ AtomicPathSwapping,
18
18
  ):
19
19
  def __init__(
20
20
  self,
@@ -27,18 +27,18 @@ class DeployTmpManager(
27
27
  )
28
28
 
29
29
  @cached_nullary
30
- def _swapping(self) -> DeployAtomicPathSwapping:
31
- return TempDirDeployAtomicPathSwapping(
30
+ def _swapping(self) -> AtomicPathSwapping:
31
+ return TempDirAtomicPathSwapping(
32
32
  temp_dir=self._make_dir(),
33
33
  root_dir=check.non_empty_str(self._deploy_home),
34
34
  )
35
35
 
36
36
  def begin_atomic_path_swap(
37
37
  self,
38
- kind: DeployAtomicPathSwapKind,
38
+ kind: AtomicPathSwapKind,
39
39
  dst_path: str,
40
40
  **kwargs: ta.Any,
41
- ) -> DeployAtomicPathSwap:
41
+ ) -> AtomicPathSwap:
42
42
  return self._swapping().begin_atomic_path_swap(
43
43
  kind,
44
44
  dst_path,
@@ -10,8 +10,8 @@ import typing as ta
10
10
  from omlish.asyncs.asyncio.subprocesses import asyncio_subprocesses
11
11
  from omlish.lite.cached import cached_nullary
12
12
  from omlish.lite.check import check
13
+ from omlish.os.atomics import AtomicPathSwapping
13
14
 
14
- from .atomics import DeployAtomicPathSwapping
15
15
  from .paths import DeployPath
16
16
  from .paths import DeployPathOwner
17
17
  from .types import DeployAppTag
@@ -23,7 +23,7 @@ class DeployVenvManager(DeployPathOwner):
23
23
  self,
24
24
  *,
25
25
  deploy_home: ta.Optional[DeployHome] = None,
26
- atomics: DeployAtomicPathSwapping,
26
+ atomics: AtomicPathSwapping,
27
27
  ) -> None:
28
28
  super().__init__()
29
29
 
@@ -105,7 +105,7 @@ class DockerManageTargetConnector(ManageTargetConnector):
105
105
  if dmt.image is not None:
106
106
  sh_parts.extend(['run', '-i', dmt.image])
107
107
  elif dmt.container_id is not None:
108
- sh_parts.extend(['exec', dmt.container_id])
108
+ sh_parts.extend(['exec', '-i', dmt.container_id])
109
109
  else:
110
110
  raise ValueError(dmt)
111
111
 
@@ -100,10 +100,6 @@ CallableVersionOperator = ta.Callable[['Version', str], bool]
100
100
  CommandT = ta.TypeVar('CommandT', bound='Command')
101
101
  CommandOutputT = ta.TypeVar('CommandOutputT', bound='Command.Output')
102
102
 
103
- # deploy/atomics.py
104
- DeployAtomicPathSwapKind = ta.Literal['dir', 'file']
105
- DeployAtomicPathSwapState = ta.Literal['open', 'committed', 'aborted'] # ta.TypeAlias
106
-
107
103
  # deploy/paths.py
108
104
  DeployPathKind = ta.Literal['dir', 'file'] # ta.TypeAlias
109
105
  DeployPathPlaceholder = ta.Literal['app', 'tag'] # ta.TypeAlias
@@ -121,6 +117,10 @@ InjectorProviderFn = ta.Callable[['Injector'], ta.Any]
121
117
  InjectorProviderFnMap = ta.Mapping['InjectorKey', 'InjectorProviderFn']
122
118
  InjectorBindingOrBindings = ta.Union['InjectorBinding', 'InjectorBindings']
123
119
 
120
+ # ../../omlish/os/atomics.py
121
+ AtomicPathSwapKind = ta.Literal['dir', 'file']
122
+ AtomicPathSwapState = ta.Literal['open', 'committed', 'aborted'] # ta.TypeAlias
123
+
124
124
  # ../configs.py
125
125
  ConfigMapping = ta.Mapping[str, ta.Any]
126
126
 
@@ -4064,204 +4064,6 @@ def build_command_name_map(crs: CommandRegistrations) -> CommandNameMap:
4064
4064
  return CommandNameMap(dct)
4065
4065
 
4066
4066
 
4067
- ########################################
4068
- # ../deploy/atomics.py
4069
-
4070
-
4071
- ##
4072
-
4073
-
4074
- class DeployAtomicPathSwap(abc.ABC):
4075
- def __init__(
4076
- self,
4077
- kind: DeployAtomicPathSwapKind,
4078
- dst_path: str,
4079
- *,
4080
- auto_commit: bool = False,
4081
- ) -> None:
4082
- super().__init__()
4083
-
4084
- self._kind = kind
4085
- self._dst_path = dst_path
4086
- self._auto_commit = auto_commit
4087
-
4088
- self._state: DeployAtomicPathSwapState = 'open'
4089
-
4090
- def __repr__(self) -> str:
4091
- return attr_repr(self, 'kind', 'dst_path', 'tmp_path')
4092
-
4093
- @property
4094
- def kind(self) -> DeployAtomicPathSwapKind:
4095
- return self._kind
4096
-
4097
- @property
4098
- def dst_path(self) -> str:
4099
- return self._dst_path
4100
-
4101
- @property
4102
- @abc.abstractmethod
4103
- def tmp_path(self) -> str:
4104
- raise NotImplementedError
4105
-
4106
- #
4107
-
4108
- @property
4109
- def state(self) -> DeployAtomicPathSwapState:
4110
- return self._state
4111
-
4112
- def _check_state(self, *states: DeployAtomicPathSwapState) -> None:
4113
- if self._state not in states:
4114
- raise RuntimeError(f'Atomic path swap not in correct state: {self._state}, {states}')
4115
-
4116
- #
4117
-
4118
- @abc.abstractmethod
4119
- def _commit(self) -> None:
4120
- raise NotImplementedError
4121
-
4122
- def commit(self) -> None:
4123
- if self._state == 'committed':
4124
- return
4125
- self._check_state('open')
4126
- try:
4127
- self._commit()
4128
- except Exception: # noqa
4129
- self._abort()
4130
- raise
4131
- else:
4132
- self._state = 'committed'
4133
-
4134
- #
4135
-
4136
- @abc.abstractmethod
4137
- def _abort(self) -> None:
4138
- raise NotImplementedError
4139
-
4140
- def abort(self) -> None:
4141
- if self._state == 'aborted':
4142
- return
4143
- self._abort()
4144
- self._state = 'aborted'
4145
-
4146
- #
4147
-
4148
- def __enter__(self) -> 'DeployAtomicPathSwap':
4149
- return self
4150
-
4151
- def __exit__(self, exc_type, exc_val, exc_tb):
4152
- if (
4153
- exc_type is None and
4154
- self._auto_commit and
4155
- self._state == 'open'
4156
- ):
4157
- self.commit()
4158
- else:
4159
- self.abort()
4160
-
4161
-
4162
- #
4163
-
4164
-
4165
- class DeployAtomicPathSwapping(abc.ABC):
4166
- @abc.abstractmethod
4167
- def begin_atomic_path_swap(
4168
- self,
4169
- kind: DeployAtomicPathSwapKind,
4170
- dst_path: str,
4171
- *,
4172
- name_hint: ta.Optional[str] = None,
4173
- make_dirs: bool = False,
4174
- **kwargs: ta.Any,
4175
- ) -> DeployAtomicPathSwap:
4176
- raise NotImplementedError
4177
-
4178
-
4179
- ##
4180
-
4181
-
4182
- class OsRenameDeployAtomicPathSwap(DeployAtomicPathSwap):
4183
- def __init__(
4184
- self,
4185
- kind: DeployAtomicPathSwapKind,
4186
- dst_path: str,
4187
- tmp_path: str,
4188
- **kwargs: ta.Any,
4189
- ) -> None:
4190
- if kind == 'dir':
4191
- check.state(os.path.isdir(tmp_path))
4192
- elif kind == 'file':
4193
- check.state(os.path.isfile(tmp_path))
4194
- else:
4195
- raise TypeError(kind)
4196
-
4197
- super().__init__(
4198
- kind,
4199
- dst_path,
4200
- **kwargs,
4201
- )
4202
-
4203
- self._tmp_path = tmp_path
4204
-
4205
- @property
4206
- def tmp_path(self) -> str:
4207
- return self._tmp_path
4208
-
4209
- def _commit(self) -> None:
4210
- os.rename(self._tmp_path, self._dst_path)
4211
-
4212
- def _abort(self) -> None:
4213
- shutil.rmtree(self._tmp_path, ignore_errors=True)
4214
-
4215
-
4216
- class TempDirDeployAtomicPathSwapping(DeployAtomicPathSwapping):
4217
- def __init__(
4218
- self,
4219
- *,
4220
- temp_dir: ta.Optional[str] = None,
4221
- root_dir: ta.Optional[str] = None,
4222
- ) -> None:
4223
- super().__init__()
4224
-
4225
- if root_dir is not None:
4226
- root_dir = os.path.abspath(root_dir)
4227
- self._root_dir = root_dir
4228
- self._temp_dir = temp_dir
4229
-
4230
- def begin_atomic_path_swap(
4231
- self,
4232
- kind: DeployAtomicPathSwapKind,
4233
- dst_path: str,
4234
- *,
4235
- name_hint: ta.Optional[str] = None,
4236
- make_dirs: bool = False,
4237
- **kwargs: ta.Any,
4238
- ) -> DeployAtomicPathSwap:
4239
- dst_path = os.path.abspath(dst_path)
4240
- if self._root_dir is not None and not dst_path.startswith(check.non_empty_str(self._root_dir)):
4241
- raise RuntimeError(f'Atomic path swap dst must be in root dir: {dst_path}, {self._root_dir}')
4242
-
4243
- dst_dir = os.path.dirname(dst_path)
4244
- if make_dirs:
4245
- os.makedirs(dst_dir, exist_ok=True)
4246
- if not os.path.isdir(dst_dir):
4247
- raise RuntimeError(f'Atomic path swap dst dir does not exist: {dst_dir}')
4248
-
4249
- if kind == 'dir':
4250
- tmp_path = tempfile.mkdtemp(prefix=name_hint, dir=self._temp_dir)
4251
- elif kind == 'file':
4252
- fd, tmp_path = tempfile.mkstemp(prefix=name_hint, dir=self._temp_dir)
4253
- os.close(fd)
4254
- else:
4255
- raise TypeError(kind)
4256
-
4257
- return OsRenameDeployAtomicPathSwap(
4258
- kind,
4259
- dst_path,
4260
- tmp_path,
4261
- **kwargs,
4262
- )
4263
-
4264
-
4265
4067
  ########################################
4266
4068
  # ../deploy/paths.py
4267
4069
  """
@@ -6516,6 +6318,201 @@ class JsonLogFormatter(logging.Formatter):
6516
6318
  return self._json_dumps(dct)
6517
6319
 
6518
6320
 
6321
+ ########################################
6322
+ # ../../../omlish/os/atomics.py
6323
+
6324
+
6325
+ ##
6326
+
6327
+
6328
+ class AtomicPathSwap(abc.ABC):
6329
+ def __init__(
6330
+ self,
6331
+ kind: AtomicPathSwapKind,
6332
+ dst_path: str,
6333
+ *,
6334
+ auto_commit: bool = False,
6335
+ ) -> None:
6336
+ super().__init__()
6337
+
6338
+ self._kind = kind
6339
+ self._dst_path = dst_path
6340
+ self._auto_commit = auto_commit
6341
+
6342
+ self._state: AtomicPathSwapState = 'open'
6343
+
6344
+ def __repr__(self) -> str:
6345
+ return attr_repr(self, 'kind', 'dst_path', 'tmp_path')
6346
+
6347
+ @property
6348
+ def kind(self) -> AtomicPathSwapKind:
6349
+ return self._kind
6350
+
6351
+ @property
6352
+ def dst_path(self) -> str:
6353
+ return self._dst_path
6354
+
6355
+ @property
6356
+ @abc.abstractmethod
6357
+ def tmp_path(self) -> str:
6358
+ raise NotImplementedError
6359
+
6360
+ #
6361
+
6362
+ @property
6363
+ def state(self) -> AtomicPathSwapState:
6364
+ return self._state
6365
+
6366
+ def _check_state(self, *states: AtomicPathSwapState) -> None:
6367
+ if self._state not in states:
6368
+ raise RuntimeError(f'Atomic path swap not in correct state: {self._state}, {states}')
6369
+
6370
+ #
6371
+
6372
+ @abc.abstractmethod
6373
+ def _commit(self) -> None:
6374
+ raise NotImplementedError
6375
+
6376
+ def commit(self) -> None:
6377
+ if self._state == 'committed':
6378
+ return
6379
+ self._check_state('open')
6380
+ try:
6381
+ self._commit()
6382
+ except Exception: # noqa
6383
+ self._abort()
6384
+ raise
6385
+ else:
6386
+ self._state = 'committed'
6387
+
6388
+ #
6389
+
6390
+ @abc.abstractmethod
6391
+ def _abort(self) -> None:
6392
+ raise NotImplementedError
6393
+
6394
+ def abort(self) -> None:
6395
+ if self._state == 'aborted':
6396
+ return
6397
+ self._abort()
6398
+ self._state = 'aborted'
6399
+
6400
+ #
6401
+
6402
+ def __enter__(self) -> 'AtomicPathSwap':
6403
+ return self
6404
+
6405
+ def __exit__(self, exc_type, exc_val, exc_tb):
6406
+ if (
6407
+ exc_type is None and
6408
+ self._auto_commit and
6409
+ self._state == 'open'
6410
+ ):
6411
+ self.commit()
6412
+ else:
6413
+ self.abort()
6414
+
6415
+
6416
+ class AtomicPathSwapping(abc.ABC):
6417
+ @abc.abstractmethod
6418
+ def begin_atomic_path_swap(
6419
+ self,
6420
+ kind: AtomicPathSwapKind,
6421
+ dst_path: str,
6422
+ *,
6423
+ name_hint: ta.Optional[str] = None,
6424
+ make_dirs: bool = False,
6425
+ **kwargs: ta.Any,
6426
+ ) -> AtomicPathSwap:
6427
+ raise NotImplementedError
6428
+
6429
+
6430
+ ##
6431
+
6432
+
6433
+ class OsRenameAtomicPathSwap(AtomicPathSwap):
6434
+ def __init__(
6435
+ self,
6436
+ kind: AtomicPathSwapKind,
6437
+ dst_path: str,
6438
+ tmp_path: str,
6439
+ **kwargs: ta.Any,
6440
+ ) -> None:
6441
+ if kind == 'dir':
6442
+ check.state(os.path.isdir(tmp_path))
6443
+ elif kind == 'file':
6444
+ check.state(os.path.isfile(tmp_path))
6445
+ else:
6446
+ raise TypeError(kind)
6447
+
6448
+ super().__init__(
6449
+ kind,
6450
+ dst_path,
6451
+ **kwargs,
6452
+ )
6453
+
6454
+ self._tmp_path = tmp_path
6455
+
6456
+ @property
6457
+ def tmp_path(self) -> str:
6458
+ return self._tmp_path
6459
+
6460
+ def _commit(self) -> None:
6461
+ os.rename(self._tmp_path, self._dst_path)
6462
+
6463
+ def _abort(self) -> None:
6464
+ shutil.rmtree(self._tmp_path, ignore_errors=True)
6465
+
6466
+
6467
+ class TempDirAtomicPathSwapping(AtomicPathSwapping):
6468
+ def __init__(
6469
+ self,
6470
+ *,
6471
+ temp_dir: ta.Optional[str] = None,
6472
+ root_dir: ta.Optional[str] = None,
6473
+ ) -> None:
6474
+ super().__init__()
6475
+
6476
+ if root_dir is not None:
6477
+ root_dir = os.path.abspath(root_dir)
6478
+ self._root_dir = root_dir
6479
+ self._temp_dir = temp_dir
6480
+
6481
+ def begin_atomic_path_swap(
6482
+ self,
6483
+ kind: AtomicPathSwapKind,
6484
+ dst_path: str,
6485
+ *,
6486
+ name_hint: ta.Optional[str] = None,
6487
+ make_dirs: bool = False,
6488
+ **kwargs: ta.Any,
6489
+ ) -> AtomicPathSwap:
6490
+ dst_path = os.path.abspath(dst_path)
6491
+ if self._root_dir is not None and not dst_path.startswith(check.non_empty_str(self._root_dir)):
6492
+ raise RuntimeError(f'Atomic path swap dst must be in root dir: {dst_path}, {self._root_dir}')
6493
+
6494
+ dst_dir = os.path.dirname(dst_path)
6495
+ if make_dirs:
6496
+ os.makedirs(dst_dir, exist_ok=True)
6497
+ if not os.path.isdir(dst_dir):
6498
+ raise RuntimeError(f'Atomic path swap dst dir does not exist: {dst_dir}')
6499
+
6500
+ if kind == 'dir':
6501
+ tmp_path = tempfile.mkdtemp(prefix=name_hint, dir=self._temp_dir)
6502
+ elif kind == 'file':
6503
+ fd, tmp_path = tempfile.mkstemp(prefix=name_hint, dir=self._temp_dir)
6504
+ os.close(fd)
6505
+ else:
6506
+ raise TypeError(kind)
6507
+
6508
+ return OsRenameAtomicPathSwap(
6509
+ kind,
6510
+ dst_path,
6511
+ tmp_path,
6512
+ **kwargs,
6513
+ )
6514
+
6515
+
6519
6516
  ########################################
6520
6517
  # ../../../omdev/interp/types.py
6521
6518
 
@@ -6752,7 +6749,7 @@ CommandExecutorMap = ta.NewType('CommandExecutorMap', ta.Mapping[ta.Type[Command
6752
6749
 
6753
6750
  class DeployTmpManager(
6754
6751
  SingleDirDeployPathOwner,
6755
- DeployAtomicPathSwapping,
6752
+ AtomicPathSwapping,
6756
6753
  ):
6757
6754
  def __init__(
6758
6755
  self,
@@ -6765,18 +6762,18 @@ class DeployTmpManager(
6765
6762
  )
6766
6763
 
6767
6764
  @cached_nullary
6768
- def _swapping(self) -> DeployAtomicPathSwapping:
6769
- return TempDirDeployAtomicPathSwapping(
6765
+ def _swapping(self) -> AtomicPathSwapping:
6766
+ return TempDirAtomicPathSwapping(
6770
6767
  temp_dir=self._make_dir(),
6771
6768
  root_dir=check.non_empty_str(self._deploy_home),
6772
6769
  )
6773
6770
 
6774
6771
  def begin_atomic_path_swap(
6775
6772
  self,
6776
- kind: DeployAtomicPathSwapKind,
6773
+ kind: AtomicPathSwapKind,
6777
6774
  dst_path: str,
6778
6775
  **kwargs: ta.Any,
6779
- ) -> DeployAtomicPathSwap:
6776
+ ) -> AtomicPathSwap:
6780
6777
  return self._swapping().begin_atomic_path_swap(
6781
6778
  kind,
6782
6779
  dst_path,
@@ -8175,7 +8172,7 @@ class DeployGitManager(SingleDirDeployPathOwner):
8175
8172
  self,
8176
8173
  *,
8177
8174
  deploy_home: ta.Optional[DeployHome] = None,
8178
- atomics: DeployAtomicPathSwapping,
8175
+ atomics: AtomicPathSwapping,
8179
8176
  ) -> None:
8180
8177
  super().__init__(
8181
8178
  owned_dir='git',
@@ -8280,7 +8277,7 @@ class DeployVenvManager(DeployPathOwner):
8280
8277
  self,
8281
8278
  *,
8282
8279
  deploy_home: ta.Optional[DeployHome] = None,
8283
- atomics: DeployAtomicPathSwapping,
8280
+ atomics: AtomicPathSwapping,
8284
8281
  ) -> None:
8285
8282
  super().__init__()
8286
8283
 
@@ -9824,7 +9821,7 @@ class DockerManageTargetConnector(ManageTargetConnector):
9824
9821
  if dmt.image is not None:
9825
9822
  sh_parts.extend(['run', '-i', dmt.image])
9826
9823
  elif dmt.container_id is not None:
9827
- sh_parts.extend(['exec', dmt.container_id])
9824
+ sh_parts.extend(['exec', '-i', dmt.container_id])
9828
9825
  else:
9829
9826
  raise ValueError(dmt)
9830
9827
 
@@ -10044,7 +10041,7 @@ def bind_deploy(
10044
10041
  inj.bind(DeployGitManager, singleton=True),
10045
10042
 
10046
10043
  inj.bind(DeployTmpManager, singleton=True),
10047
- inj.bind(DeployAtomicPathSwapping, to_key=DeployTmpManager),
10044
+ inj.bind(AtomicPathSwapping, to_key=DeployTmpManager),
10048
10045
 
10049
10046
  inj.bind(DeployVenvManager, singleton=True),
10050
10047
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ominfra
3
- Version: 0.0.0.dev160
3
+ Version: 0.0.0.dev161
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.dev160
16
- Requires-Dist: omlish==0.0.0.dev160
15
+ Requires-Dist: omdev==0.0.0.dev161
16
+ Requires-Dist: omlish==0.0.0.dev161
17
17
  Provides-Extra: all
18
18
  Requires-Dist: paramiko~=3.5; extra == "all"
19
19
  Requires-Dist: asyncssh~=2.18; extra == "all"
@@ -55,7 +55,6 @@ ominfra/manage/commands/subprocess.py
55
55
  ominfra/manage/commands/types.py
56
56
  ominfra/manage/deploy/__init__.py
57
57
  ominfra/manage/deploy/apps.py
58
- ominfra/manage/deploy/atomics.py
59
58
  ominfra/manage/deploy/commands.py
60
59
  ominfra/manage/deploy/config.py
61
60
  ominfra/manage/deploy/git.py
@@ -1,5 +1,5 @@
1
- omdev==0.0.0.dev160
2
- omlish==0.0.0.dev160
1
+ omdev==0.0.0.dev161
2
+ omlish==0.0.0.dev161
3
3
 
4
4
  [all]
5
5
  paramiko~=3.5
@@ -12,7 +12,7 @@ authors = [
12
12
  urls = {source = 'https://github.com/wrmsr/omlish'}
13
13
  license = {text = 'BSD-3-Clause'}
14
14
  requires-python = '>=3.12'
15
- version = '0.0.0.dev160'
15
+ version = '0.0.0.dev161'
16
16
  classifiers = [
17
17
  'License :: OSI Approved :: BSD License',
18
18
  'Development Status :: 2 - Pre-Alpha',
@@ -22,8 +22,8 @@ classifiers = [
22
22
  ]
23
23
  description = 'ominfra'
24
24
  dependencies = [
25
- 'omdev == 0.0.0.dev160',
26
- 'omlish == 0.0.0.dev160',
25
+ 'omdev == 0.0.0.dev161',
26
+ 'omlish == 0.0.0.dev161',
27
27
  ]
28
28
 
29
29
  [project.optional-dependencies]