ominfra 0.0.0.dev156__tar.gz → 0.0.0.dev157__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (132) hide show
  1. {ominfra-0.0.0.dev156/ominfra.egg-info → ominfra-0.0.0.dev157}/PKG-INFO +3 -3
  2. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/main.py +33 -4
  3. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/remote/spawning.py +1 -6
  4. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/scripts/journald2aws.py +3 -2
  5. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/scripts/manage.py +946 -11
  6. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/scripts/supervisor.py +44 -31
  7. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/supervisor/configs.py +2 -0
  8. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/supervisor/supervisor.py +2 -33
  9. ominfra-0.0.0.dev157/ominfra/supervisor/utils/os.py +86 -0
  10. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157/ominfra.egg-info}/PKG-INFO +3 -3
  11. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra.egg-info/requires.txt +2 -2
  12. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/pyproject.toml +3 -3
  13. ominfra-0.0.0.dev156/ominfra/supervisor/utils/os.py +0 -45
  14. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/LICENSE +0 -0
  15. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/MANIFEST.in +0 -0
  16. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/README.rst +0 -0
  17. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/.manifests.json +0 -0
  18. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/__about__.py +0 -0
  19. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/__init__.py +0 -0
  20. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/clouds/__init__.py +0 -0
  21. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/clouds/aws/__init__.py +0 -0
  22. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/clouds/aws/__main__.py +0 -0
  23. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/clouds/aws/auth.py +0 -0
  24. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/clouds/aws/cli.py +0 -0
  25. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/clouds/aws/dataclasses.py +0 -0
  26. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/clouds/aws/journald2aws/__init__.py +0 -0
  27. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/clouds/aws/journald2aws/__main__.py +0 -0
  28. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/clouds/aws/journald2aws/cursor.py +0 -0
  29. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/clouds/aws/journald2aws/driver.py +0 -0
  30. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/clouds/aws/journald2aws/main.py +0 -0
  31. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/clouds/aws/journald2aws/poster.py +0 -0
  32. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/clouds/aws/logs.py +0 -0
  33. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/clouds/aws/metadata.py +0 -0
  34. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/clouds/gcp/__init__.py +0 -0
  35. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/clouds/gcp/auth.py +0 -0
  36. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/cmds.py +0 -0
  37. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/configs.py +0 -0
  38. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/journald/__init__.py +0 -0
  39. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/journald/fields.py +0 -0
  40. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/journald/genmessages.py +0 -0
  41. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/journald/messages.py +0 -0
  42. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/journald/tailer.py +0 -0
  43. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/__init__.py +0 -0
  44. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/__main__.py +0 -0
  45. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/bootstrap.py +0 -0
  46. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/bootstrap_.py +0 -0
  47. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/commands/__init__.py +0 -0
  48. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/commands/base.py +0 -0
  49. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/commands/inject.py +0 -0
  50. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/commands/local.py +0 -0
  51. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/commands/marshal.py +0 -0
  52. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/commands/ping.py +0 -0
  53. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/commands/subprocess.py +0 -0
  54. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/commands/types.py +0 -0
  55. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/config.py +0 -0
  56. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/deploy/__init__.py +0 -0
  57. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/deploy/apps.py +0 -0
  58. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/deploy/commands.py +0 -0
  59. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/deploy/config.py +0 -0
  60. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/deploy/git.py +0 -0
  61. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/deploy/inject.py +0 -0
  62. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/deploy/interp.py +0 -0
  63. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/deploy/paths.py +0 -0
  64. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/deploy/types.py +0 -0
  65. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/deploy/venvs.py +0 -0
  66. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/inject.py +0 -0
  67. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/marshal.py +0 -0
  68. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/remote/__init__.py +0 -0
  69. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/remote/_main.py +0 -0
  70. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/remote/channel.py +0 -0
  71. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/remote/config.py +0 -0
  72. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/remote/connection.py +0 -0
  73. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/remote/execution.py +0 -0
  74. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/remote/inject.py +0 -0
  75. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/remote/payload.py +0 -0
  76. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/system/__init__.py +0 -0
  77. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/system/commands.py +0 -0
  78. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/system/config.py +0 -0
  79. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/system/inject.py +0 -0
  80. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/system/packages.py +0 -0
  81. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/system/platforms.py +0 -0
  82. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/targets/__init__.py +0 -0
  83. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/targets/connection.py +0 -0
  84. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/targets/inject.py +0 -0
  85. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/manage/targets/targets.py +0 -0
  86. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/pyremote.py +0 -0
  87. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/scripts/__init__.py +0 -0
  88. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/ssh.py +0 -0
  89. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/supervisor/LICENSE.txt +0 -0
  90. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/supervisor/__init__.py +0 -0
  91. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/supervisor/__main__.py +0 -0
  92. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/supervisor/dispatchers.py +0 -0
  93. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/supervisor/dispatchersimpl.py +0 -0
  94. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/supervisor/events.py +0 -0
  95. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/supervisor/exceptions.py +0 -0
  96. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/supervisor/groups.py +0 -0
  97. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/supervisor/groupsimpl.py +0 -0
  98. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/supervisor/http.py +0 -0
  99. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/supervisor/inject.py +0 -0
  100. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/supervisor/io.py +0 -0
  101. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/supervisor/main.py +0 -0
  102. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/supervisor/pipes.py +0 -0
  103. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/supervisor/privileges.py +0 -0
  104. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/supervisor/process.py +0 -0
  105. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/supervisor/processimpl.py +0 -0
  106. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/supervisor/setup.py +0 -0
  107. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/supervisor/setupimpl.py +0 -0
  108. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/supervisor/signals.py +0 -0
  109. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/supervisor/spawning.py +0 -0
  110. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/supervisor/spawningimpl.py +0 -0
  111. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/supervisor/states.py +0 -0
  112. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/supervisor/types.py +0 -0
  113. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/supervisor/utils/__init__.py +0 -0
  114. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/supervisor/utils/collections.py +0 -0
  115. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/supervisor/utils/diag.py +0 -0
  116. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/supervisor/utils/fds.py +0 -0
  117. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/supervisor/utils/fs.py +0 -0
  118. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/supervisor/utils/ostypes.py +0 -0
  119. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/supervisor/utils/signals.py +0 -0
  120. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/supervisor/utils/strings.py +0 -0
  121. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/supervisor/utils/users.py +0 -0
  122. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/tailscale/__init__.py +0 -0
  123. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/tailscale/api.py +0 -0
  124. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/tailscale/cli.py +0 -0
  125. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/threadworkers.py +0 -0
  126. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/tools/__init__.py +0 -0
  127. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra/tools/listresources.py +0 -0
  128. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra.egg-info/SOURCES.txt +0 -0
  129. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra.egg-info/dependency_links.txt +0 -0
  130. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra.egg-info/entry_points.txt +0 -0
  131. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/ominfra.egg-info/top_level.txt +0 -0
  132. {ominfra-0.0.0.dev156 → ominfra-0.0.0.dev157}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ominfra
3
- Version: 0.0.0.dev156
3
+ Version: 0.0.0.dev157
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.dev156
16
- Requires-Dist: omlish==0.0.0.dev156
15
+ Requires-Dist: omdev==0.0.0.dev157
16
+ Requires-Dist: omlish==0.0.0.dev157
17
17
  Provides-Extra: all
18
18
  Requires-Dist: paramiko~=3.5; extra == "all"
19
19
  Requires-Dist: asyncssh~=2.18; extra == "all"
@@ -6,18 +6,23 @@ manage.py -s 'docker run -i python:3.12'
6
6
  manage.py -s 'ssh -i /foo/bar.pem foo@bar.baz' -q --python=python3.8
7
7
  """
8
8
  import asyncio
9
+ import dataclasses as dc
9
10
  import json
11
+ import os.path
10
12
  import sys
11
13
  import typing as ta
12
14
 
13
15
  from omlish.argparse.cli import ArgparseCli
14
16
  from omlish.argparse.cli import argparse_arg
15
17
  from omlish.argparse.cli import argparse_command
18
+ from omlish.lite.cached import cached_nullary
19
+ from omlish.lite.check import check
16
20
  from omlish.lite.logs import log # noqa
17
21
  from omlish.lite.marshal import ObjMarshalerManager
18
22
  from omlish.lite.marshal import ObjMarshalOptions
19
23
  from omlish.lite.pycharm import PycharmRemoteDebug
20
24
 
25
+ from ..configs import read_config_file
21
26
  from .bootstrap import MainBootstrap
22
27
  from .bootstrap_ import main_bootstrap
23
28
  from .commands.base import Command
@@ -28,7 +33,28 @@ from .targets.connection import ManageTargetConnector
28
33
  from .targets.targets import ManageTarget
29
34
 
30
35
 
36
+ @dc.dataclass(frozen=True)
37
+ class ManageConfig:
38
+ targets: ta.Optional[ta.Mapping[str, ManageTarget]] = None
39
+
40
+
31
41
  class MainCli(ArgparseCli):
42
+ config_file: ta.Optional[str] = argparse_arg('--config-file', help='Config file path') # type: ignore
43
+
44
+ @cached_nullary
45
+ def config(self) -> ManageConfig:
46
+ if (cf := self.config_file) is None:
47
+ cf = os.path.expanduser('~/.omlish/manage.yml')
48
+ if not os.path.isfile(cf):
49
+ cf = None
50
+
51
+ if cf is None:
52
+ return ManageConfig()
53
+ else:
54
+ return read_config_file(cf, ManageConfig)
55
+
56
+ #
57
+
32
58
  @argparse_command(
33
59
  argparse_arg('--_payload-file'),
34
60
 
@@ -80,10 +106,13 @@ class MainCli(ArgparseCli):
80
106
 
81
107
  msh = injector[ObjMarshalerManager]
82
108
 
83
- ts = self.args.target
84
- if not ts.startswith('{'):
85
- ts = json.dumps({ts: {}})
86
- tgt: ManageTarget = msh.unmarshal_obj(json.loads(ts), ManageTarget)
109
+ tgt: ManageTarget
110
+ if not (ts := self.args.target).startswith('{'):
111
+ tgt = check.not_none(self.config().targets)[ts]
112
+ else:
113
+ tgt = msh.unmarshal_obj(json.loads(ts), ManageTarget)
114
+
115
+ #
87
116
 
88
117
  cmds: ta.List[Command] = []
89
118
  cmd: Command
@@ -11,7 +11,6 @@ from omlish.lite.asyncio.subprocesses import asyncio_subprocesses
11
11
  from omlish.lite.check import check
12
12
  from omlish.lite.subprocesses import SUBPROCESS_CHANNEL_OPTION_VALUES
13
13
  from omlish.lite.subprocesses import SubprocessChannelOption
14
- from omlish.lite.subprocesses import subprocess_maybe_shell_wrap_exec
15
14
 
16
15
 
17
16
  ##
@@ -82,12 +81,8 @@ class SubprocessRemoteSpawning(RemoteSpawning):
82
81
  ) -> ta.AsyncGenerator[RemoteSpawning.Spawned, None]:
83
82
  pc = self._prepare_cmd(tgt, src)
84
83
 
85
- cmd = pc.cmd
86
- if not debug:
87
- cmd = subprocess_maybe_shell_wrap_exec(*cmd)
88
-
89
84
  async with asyncio_subprocesses.popen(
90
- *cmd,
85
+ *pc.cmd,
91
86
  shell=pc.shell,
92
87
  stdin=subprocess.PIPE,
93
88
  stdout=subprocess.PIPE,
@@ -932,8 +932,8 @@ class _CachedNullary(_AbstractCachedNullary):
932
932
  return self._value
933
933
 
934
934
 
935
- def cached_nullary(fn): # ta.Callable[..., T]) -> ta.Callable[..., T]:
936
- return _CachedNullary(fn)
935
+ def cached_nullary(fn: CallableT) -> CallableT:
936
+ return _CachedNullary(fn) # type: ignore
937
937
 
938
938
 
939
939
  def static_init(fn: CallableT) -> CallableT:
@@ -2559,6 +2559,7 @@ TODO:
2559
2559
  - pickle stdlib objs? have to pin to 3.8 pickle protocol, will be cross-version
2560
2560
  - namedtuple
2561
2561
  - literals
2562
+ - newtypes?
2562
2563
  """
2563
2564
 
2564
2565