ominfra 0.0.0.dev368__py3-none-any.whl → 0.0.0.dev501__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.
Potentially problematic release.
This version of ominfra might be problematic. Click here for more details.
- ominfra/{.manifests.json → .omlish-manifests.json} +6 -6
- ominfra/README.md +26 -0
- ominfra/__about__.py +6 -3
- ominfra/clouds/aws/auth.py +1 -0
- ominfra/clouds/aws/instancetypes/cache.json.gz +0 -0
- ominfra/clouds/aws/instancetypes/cli.py +1 -1
- ominfra/clouds/aws/journald2aws/cursor.py +5 -1
- ominfra/clouds/aws/journald2aws/driver.py +4 -1
- ominfra/clouds/aws/journald2aws/main.py +1 -1
- ominfra/clouds/aws/journald2aws/poster.py +5 -1
- ominfra/clouds/aws/models/{base.py → base/__init__.py} +7 -2
- ominfra/clouds/aws/models/base/_dataclasses.py +721 -0
- ominfra/clouds/aws/models/gen/cli.py +2 -1
- ominfra/clouds/aws/models/gen/gen.py +16 -7
- ominfra/clouds/aws/models/services/{ec2.py → ec2/__init__.py} +227 -1
- ominfra/clouds/aws/models/services/ec2/_dataclasses.py +30654 -0
- ominfra/clouds/aws/models/services/{lambda_.py → lambda_/__init__.py} +139 -1
- ominfra/clouds/aws/models/services/lambda_/_dataclasses.py +4182 -0
- ominfra/clouds/aws/models/services/{rds.py → rds/__init__.py} +254 -78
- ominfra/clouds/aws/models/services/rds/_dataclasses.py +8231 -0
- ominfra/clouds/aws/models/services/{s3.py → s3/__init__.py} +9 -1
- ominfra/clouds/aws/models/services/s3/_dataclasses.py +5014 -0
- ominfra/commands/runners.py +2 -0
- ominfra/commands/ssh.py +3 -0
- ominfra/journald/messages.py +4 -1
- ominfra/journald/tailer.py +13 -10
- ominfra/manage/bootstrap_.py +1 -1
- ominfra/manage/commands/base.py +7 -6
- ominfra/manage/deploy/commands.py +4 -1
- ominfra/manage/deploy/conf/specs.py +2 -2
- ominfra/manage/deploy/paths/owners.py +3 -2
- ominfra/manage/deploy/paths/paths.py +4 -3
- ominfra/manage/deploy/tags.py +8 -8
- ominfra/manage/inject.py +2 -1
- ominfra/manage/main.py +5 -3
- ominfra/manage/remote/_main.py +5 -1
- ominfra/manage/remote/channel.py +2 -1
- ominfra/manage/remote/execution.py +10 -6
- ominfra/manage/remote/spawning.py +2 -1
- ominfra/manage/system/commands.py +4 -1
- ominfra/manage/system/packages.py +2 -1
- ominfra/manage/system/platforms.py +7 -4
- ominfra/manage/targets/bestpython.sh +1 -1
- ominfra/manage/targets/connection.py +2 -1
- ominfra/manage/targets/targets.py +5 -5
- ominfra/scripts/journald2aws.py +5386 -2425
- ominfra/scripts/manage.py +10604 -7389
- ominfra/scripts/supervisor.py +7168 -4002
- ominfra/supervisor/configs.py +6 -6
- ominfra/supervisor/dispatchers.py +3 -0
- ominfra/supervisor/dispatchersimpl.py +9 -3
- ominfra/supervisor/events.py +13 -6
- ominfra/supervisor/groups.py +3 -0
- ominfra/supervisor/groupsimpl.py +3 -0
- ominfra/supervisor/http.py +1 -1
- ominfra/supervisor/inject.py +3 -0
- ominfra/supervisor/io.py +4 -1
- ominfra/supervisor/main.py +4 -4
- ominfra/supervisor/pipes.py +3 -0
- ominfra/supervisor/privileges.py +3 -0
- ominfra/supervisor/processimpl.py +4 -1
- ominfra/supervisor/setup.py +4 -2
- ominfra/supervisor/setupimpl.py +4 -1
- ominfra/supervisor/signals.py +7 -1
- ominfra/supervisor/spawning.py +3 -0
- ominfra/supervisor/supervisor.py +4 -1
- ominfra/supervisor/types.py +9 -8
- ominfra/supervisor/utils/collections.py +7 -2
- ominfra/supervisor/utils/diag.py +3 -0
- ominfra/supervisor/utils/fds.py +3 -0
- ominfra/supervisor/utils/fs.py +3 -0
- ominfra/supervisor/utils/os.py +3 -2
- ominfra/supervisor/utils/strings.py +1 -0
- ominfra/threadworkers.py +6 -2
- ominfra/tools/listresources.py +1 -1
- ominfra-0.0.0.dev501.dist-info/METADATA +54 -0
- {ominfra-0.0.0.dev368.dist-info → ominfra-0.0.0.dev501.dist-info}/RECORD +81 -75
- ominfra-0.0.0.dev368.dist-info/METADATA +0 -23
- {ominfra-0.0.0.dev368.dist-info → ominfra-0.0.0.dev501.dist-info}/WHEEL +0 -0
- {ominfra-0.0.0.dev368.dist-info → ominfra-0.0.0.dev501.dist-info}/entry_points.txt +0 -0
- {ominfra-0.0.0.dev368.dist-info → ominfra-0.0.0.dev501.dist-info}/licenses/LICENSE +0 -0
- {ominfra-0.0.0.dev368.dist-info → ominfra-0.0.0.dev501.dist-info}/top_level.txt +0 -0
ominfra/commands/runners.py
CHANGED
|
@@ -38,6 +38,7 @@ class CommandRunner(lang.Abstract):
|
|
|
38
38
|
class ReturnCodeError(Exception):
|
|
39
39
|
def __init__(self, result: 'CommandRunner.Result') -> None:
|
|
40
40
|
super().__init__(f'Bad return code: {result.rc}', result)
|
|
41
|
+
|
|
41
42
|
self.result = result
|
|
42
43
|
|
|
43
44
|
@abc.abstractmethod
|
|
@@ -52,6 +53,7 @@ class LocalCommandRunner(CommandRunner):
|
|
|
52
53
|
|
|
53
54
|
def __init__(self, cfg: Config = Config()) -> None:
|
|
54
55
|
super().__init__()
|
|
56
|
+
|
|
55
57
|
self._cfg = check.isinstance(cfg, LocalCommandRunner.Config)
|
|
56
58
|
|
|
57
59
|
async def run_command(self, cmd: CommandRunner.Command) -> CommandRunner.Result:
|
ominfra/commands/ssh.py
CHANGED
|
@@ -56,6 +56,7 @@ class SshSubprocessCommandRunner(CommandRunner):
|
|
|
56
56
|
lcr: LocalCommandRunner | None = None,
|
|
57
57
|
) -> None:
|
|
58
58
|
super().__init__()
|
|
59
|
+
|
|
59
60
|
self._cfg = check.isinstance(cfg, SshConfig)
|
|
60
61
|
self._lcr = check.isinstance(lcr, LocalCommandRunner) if lcr is not None else LocalCommandRunner()
|
|
61
62
|
|
|
@@ -89,6 +90,7 @@ class AsyncsshSshCommandRunner(CommandRunner):
|
|
|
89
90
|
cfg: SshConfig,
|
|
90
91
|
) -> None:
|
|
91
92
|
super().__init__()
|
|
93
|
+
|
|
92
94
|
self._cfg = check.isinstance(cfg, SshConfig)
|
|
93
95
|
|
|
94
96
|
async def run_command(self, cmd: CommandRunner.Command) -> CommandRunner.Result:
|
|
@@ -122,6 +124,7 @@ class ParamikoSshCommandRunner(CommandRunner):
|
|
|
122
124
|
cfg: SshConfig,
|
|
123
125
|
) -> None:
|
|
124
126
|
super().__init__()
|
|
127
|
+
|
|
125
128
|
self._cfg = check.isinstance(cfg, SshConfig)
|
|
126
129
|
|
|
127
130
|
def _run_command(self, cmd: CommandRunner.Command) -> CommandRunner.Result:
|
ominfra/journald/messages.py
CHANGED
|
@@ -6,7 +6,10 @@ import typing as ta
|
|
|
6
6
|
|
|
7
7
|
from omlish.io.buffers import DelimitingBuffer
|
|
8
8
|
from omlish.lite.check import check
|
|
9
|
-
from omlish.
|
|
9
|
+
from omlish.logs.modules import get_module_logger
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
log = get_module_logger(globals()) # noqa
|
|
10
13
|
|
|
11
14
|
|
|
12
15
|
##
|
ominfra/journald/tailer.py
CHANGED
|
@@ -190,7 +190,7 @@ Output Options
|
|
|
190
190
|
Reverse output so that the newest entries are displayed first.
|
|
191
191
|
--show-cursor
|
|
192
192
|
The cursor is shown after the last entry after two dashes:
|
|
193
|
-
-- cursor: s=0639
|
|
193
|
+
-- cursor: s=0639...
|
|
194
194
|
The format of the cursor is private and subject to change.
|
|
195
195
|
--utc
|
|
196
196
|
Express time in Coordinated Universal Time (UTC).
|
|
@@ -218,7 +218,7 @@ Output Options
|
|
|
218
218
|
--no-tail
|
|
219
219
|
Show all stored output lines, even in follow mode. Undoes the effect of --lines=.
|
|
220
220
|
-q, --quiet
|
|
221
|
-
Suppresses all informational messages (i.e. "-- Journal begins at
|
|
221
|
+
Suppresses all informational messages (i.e. "-- Journal begins at ...", "-- Reboot --"), any warning messages
|
|
222
222
|
regarding inaccessible system journals when run as a normal user.
|
|
223
223
|
|
|
224
224
|
Pager Control Options
|
|
@@ -302,10 +302,10 @@ Commands
|
|
|
302
302
|
Instead of showing journal contents, show internal header information of the journal fields accessed. This option is
|
|
303
303
|
particularly useful when trying to identify out-of-order journal entries, as happens for example when the machine is
|
|
304
304
|
booted with the wrong system time.
|
|
305
|
-
--list-catalog [128-bit-ID
|
|
305
|
+
--list-catalog [128-bit-ID...]
|
|
306
306
|
List the contents of the message catalog as a table of message IDs, plus their short description strings. If any
|
|
307
307
|
128-bit-IDs are specified, only those entries are shown.
|
|
308
|
-
--dump-catalog [128-bit-ID
|
|
308
|
+
--dump-catalog [128-bit-ID...]
|
|
309
309
|
Show the contents of the message catalog, with entries separated by a line consisting of two dashes and the ID (the
|
|
310
310
|
format is the same as .catalog files). If any 128-bit-IDs are specified, only those entries are shown.
|
|
311
311
|
--update-catalog
|
|
@@ -326,11 +326,11 @@ Environment
|
|
|
326
326
|
$SYSTEMD_LOG_LEVEL
|
|
327
327
|
The maximum log level of emitted messages (messages with a higher log level, i.e. less important ones, will be
|
|
328
328
|
suppressed). Takes a comma-separated list of values. A value may be either one of (in order of decreasing
|
|
329
|
-
importance) emerg, alert, crit, err, warning, notice, info, debug, or an integer in the range 0
|
|
330
|
-
more information. Each value may optionally be prefixed with one of console, syslog, kmsg or journal followed by
|
|
331
|
-
colon to set the maximum log level for that specific log target (e.g. SYSTEMD_LOG_LEVEL=debug,console:info
|
|
332
|
-
to log at debug level except when logging to the console which should be at info level). Note that the
|
|
333
|
-
maximum log level takes priority over any per target maximum log levels.
|
|
329
|
+
importance) emerg, alert, crit, err, warning, notice, info, debug, or an integer in the range 0...7. See syslog(3)
|
|
330
|
+
for more information. Each value may optionally be prefixed with one of console, syslog, kmsg or journal followed by
|
|
331
|
+
a colon to set the maximum log level for that specific log target (e.g. SYSTEMD_LOG_LEVEL=debug,console:info
|
|
332
|
+
specifies to log at debug level except when logging to the console which should be at info level). Note that the
|
|
333
|
+
global maximum log level takes priority over any per target maximum log levels.
|
|
334
334
|
$SYSTEMD_LOG_COLOR
|
|
335
335
|
A boolean. If true, messages written to the tty will be colored according to priority. This setting is only useful
|
|
336
336
|
when messages are written directly to the terminal, because journalctl(1) and other tools that display logs will
|
|
@@ -409,7 +409,7 @@ import typing as ta
|
|
|
409
409
|
|
|
410
410
|
from omlish.lite.cached import cached_nullary
|
|
411
411
|
from omlish.lite.check import check
|
|
412
|
-
from omlish.
|
|
412
|
+
from omlish.logs.modules import get_module_logger
|
|
413
413
|
from omlish.subprocesses.utils import subprocess_close
|
|
414
414
|
from omlish.subprocesses.wrap import subprocess_shell_wrap_exec
|
|
415
415
|
|
|
@@ -418,6 +418,9 @@ from .messages import JournalctlMessage # noqa
|
|
|
418
418
|
from .messages import JournalctlMessageBuilder
|
|
419
419
|
|
|
420
420
|
|
|
421
|
+
log = get_module_logger(globals()) # noqa
|
|
422
|
+
|
|
423
|
+
|
|
421
424
|
##
|
|
422
425
|
|
|
423
426
|
|
ominfra/manage/bootstrap_.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# ruff: noqa: UP006 UP007 UP045
|
|
2
2
|
from omlish.lite.inject import Injector
|
|
3
3
|
from omlish.lite.inject import inj
|
|
4
|
-
from omlish.logs.standard import configure_standard_logging
|
|
4
|
+
from omlish.logs.std.standard import configure_standard_logging
|
|
5
5
|
|
|
6
6
|
from .bootstrap import MainBootstrap
|
|
7
7
|
from .inject import bind_main
|
ominfra/manage/commands/base.py
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
# ruff: noqa: UP006 UP007 UP045
|
|
2
2
|
import abc
|
|
3
3
|
import dataclasses as dc
|
|
4
|
-
import logging
|
|
5
4
|
import traceback
|
|
6
5
|
import typing as ta
|
|
7
6
|
|
|
7
|
+
from omlish.lite.abstract import Abstract
|
|
8
8
|
from omlish.lite.check import check
|
|
9
9
|
from omlish.lite.strings import snake_case
|
|
10
|
+
from omlish.logs.protocols import LoggerLike
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
CommandT = ta.TypeVar('CommandT', bound='Command')
|
|
@@ -17,9 +18,9 @@ CommandOutputT = ta.TypeVar('CommandOutputT', bound='Command.Output')
|
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
@dc.dataclass(frozen=True)
|
|
20
|
-
class Command(
|
|
21
|
+
class Command(Abstract, ta.Generic[CommandOutputT]):
|
|
21
22
|
@dc.dataclass(frozen=True)
|
|
22
|
-
class Output(
|
|
23
|
+
class Output(Abstract):
|
|
23
24
|
pass
|
|
24
25
|
|
|
25
26
|
@ta.final
|
|
@@ -65,7 +66,7 @@ class CommandException:
|
|
|
65
66
|
)
|
|
66
67
|
|
|
67
68
|
|
|
68
|
-
class CommandOutputOrException(
|
|
69
|
+
class CommandOutputOrException(Abstract, ta.Generic[CommandOutputT]):
|
|
69
70
|
@property
|
|
70
71
|
@abc.abstractmethod
|
|
71
72
|
def output(self) -> ta.Optional[CommandOutputT]:
|
|
@@ -83,7 +84,7 @@ class CommandOutputOrExceptionData(CommandOutputOrException):
|
|
|
83
84
|
exception: ta.Optional[CommandException] = None
|
|
84
85
|
|
|
85
86
|
|
|
86
|
-
class CommandExecutor(
|
|
87
|
+
class CommandExecutor(Abstract, ta.Generic[CommandT, CommandOutputT]):
|
|
87
88
|
@abc.abstractmethod
|
|
88
89
|
def execute(self, cmd: CommandT) -> ta.Awaitable[CommandOutputT]:
|
|
89
90
|
raise NotImplementedError
|
|
@@ -92,7 +93,7 @@ class CommandExecutor(abc.ABC, ta.Generic[CommandT, CommandOutputT]):
|
|
|
92
93
|
self,
|
|
93
94
|
cmd: CommandT,
|
|
94
95
|
*,
|
|
95
|
-
log: ta.Optional[
|
|
96
|
+
log: ta.Optional[LoggerLike] = None,
|
|
96
97
|
omit_exc_object: bool = False,
|
|
97
98
|
) -> CommandOutputOrException[CommandOutputT]:
|
|
98
99
|
try:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# ruff: noqa: UP006 UP007 UP045
|
|
2
2
|
import dataclasses as dc
|
|
3
3
|
|
|
4
|
-
from omlish.
|
|
4
|
+
from omlish.logs.modules import get_module_logger
|
|
5
5
|
|
|
6
6
|
from ..commands.base import Command
|
|
7
7
|
from ..commands.base import CommandExecutor
|
|
@@ -9,6 +9,9 @@ from .deploy import DeployDriverFactory
|
|
|
9
9
|
from .specs import DeploySpec
|
|
10
10
|
|
|
11
11
|
|
|
12
|
+
log = get_module_logger(globals()) # noqa
|
|
13
|
+
|
|
14
|
+
|
|
12
15
|
##
|
|
13
16
|
|
|
14
17
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# ruff: noqa: UP006 UP007 UP045
|
|
2
|
-
import abc
|
|
3
2
|
import dataclasses as dc
|
|
4
3
|
import typing as ta
|
|
5
4
|
|
|
6
5
|
from omlish.formats.ini.sections import IniSectionSettingsMap
|
|
6
|
+
from omlish.lite.abstract import Abstract
|
|
7
7
|
from omlish.lite.check import check
|
|
8
8
|
from omlish.lite.marshal import register_single_field_type_obj_marshaler
|
|
9
9
|
|
|
@@ -13,7 +13,7 @@ from ..paths.specs import check_valid_deploy_spec_path
|
|
|
13
13
|
##
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
class DeployAppConfContent(
|
|
16
|
+
class DeployAppConfContent(Abstract):
|
|
17
17
|
pass
|
|
18
18
|
|
|
19
19
|
|
|
@@ -3,6 +3,7 @@ import abc
|
|
|
3
3
|
import os.path
|
|
4
4
|
import typing as ta
|
|
5
5
|
|
|
6
|
+
from omlish.lite.abstract import Abstract
|
|
6
7
|
from omlish.lite.check import check
|
|
7
8
|
|
|
8
9
|
from ..types import DeployHome
|
|
@@ -12,7 +13,7 @@ from .paths import DeployPath
|
|
|
12
13
|
##
|
|
13
14
|
|
|
14
15
|
|
|
15
|
-
class DeployPathOwner(
|
|
16
|
+
class DeployPathOwner(Abstract):
|
|
16
17
|
@abc.abstractmethod
|
|
17
18
|
def get_owned_deploy_paths(self) -> ta.AbstractSet[DeployPath]:
|
|
18
19
|
raise NotImplementedError
|
|
@@ -21,7 +22,7 @@ class DeployPathOwner(abc.ABC):
|
|
|
21
22
|
DeployPathOwners = ta.NewType('DeployPathOwners', ta.Sequence[DeployPathOwner])
|
|
22
23
|
|
|
23
24
|
|
|
24
|
-
class SingleDirDeployPathOwner(DeployPathOwner,
|
|
25
|
+
class SingleDirDeployPathOwner(DeployPathOwner, Abstract):
|
|
25
26
|
def __init__(
|
|
26
27
|
self,
|
|
27
28
|
*args: ta.Any,
|
|
@@ -13,6 +13,7 @@ import dataclasses as dc
|
|
|
13
13
|
import itertools
|
|
14
14
|
import typing as ta
|
|
15
15
|
|
|
16
|
+
from omlish.lite.abstract import Abstract
|
|
16
17
|
from omlish.lite.cached import cached_nullary
|
|
17
18
|
from omlish.lite.check import check
|
|
18
19
|
from omlish.lite.strings import split_keep_delimiter
|
|
@@ -32,7 +33,7 @@ class DeployPathError(Exception):
|
|
|
32
33
|
pass
|
|
33
34
|
|
|
34
35
|
|
|
35
|
-
class DeployPathRenderable(
|
|
36
|
+
class DeployPathRenderable(Abstract):
|
|
36
37
|
@cached_nullary
|
|
37
38
|
def __str__(self) -> str:
|
|
38
39
|
return self.render(None)
|
|
@@ -45,7 +46,7 @@ class DeployPathRenderable(abc.ABC):
|
|
|
45
46
|
##
|
|
46
47
|
|
|
47
48
|
|
|
48
|
-
class DeployPathNamePart(DeployPathRenderable,
|
|
49
|
+
class DeployPathNamePart(DeployPathRenderable, Abstract):
|
|
49
50
|
@classmethod
|
|
50
51
|
def parse(cls, s: str) -> 'DeployPathNamePart':
|
|
51
52
|
check.non_empty_str(s)
|
|
@@ -137,7 +138,7 @@ class DeployPathName(DeployPathRenderable):
|
|
|
137
138
|
|
|
138
139
|
|
|
139
140
|
@dc.dataclass(frozen=True)
|
|
140
|
-
class DeployPathPart(DeployPathRenderable,
|
|
141
|
+
class DeployPathPart(DeployPathRenderable, Abstract):
|
|
141
142
|
name: DeployPathName
|
|
142
143
|
|
|
143
144
|
@property
|
ominfra/manage/deploy/tags.py
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# ruff: noqa: UP006 UP007 UP045
|
|
2
|
-
import abc
|
|
3
2
|
import dataclasses as dc
|
|
4
3
|
import typing as ta
|
|
5
4
|
|
|
5
|
+
from omlish.lite.abstract import Abstract
|
|
6
6
|
from omlish.lite.check import check
|
|
7
7
|
from omlish.lite.marshal import register_single_field_type_obj_marshaler
|
|
8
8
|
|
|
@@ -30,11 +30,11 @@ DEPLOY_TAG_ILLEGAL_STRS: ta.AbstractSet[str] = frozenset([
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
@dc.dataclass(frozen=True, order=True)
|
|
33
|
-
class DeployTag(
|
|
33
|
+
class DeployTag(Abstract):
|
|
34
34
|
s: str
|
|
35
35
|
|
|
36
36
|
def __post_init__(self) -> None:
|
|
37
|
-
check.not_in(
|
|
37
|
+
check.not_in(Abstract, type(self).__bases__)
|
|
38
38
|
check.non_empty_str(self.s)
|
|
39
39
|
for ch in DEPLOY_TAG_ILLEGAL_STRS:
|
|
40
40
|
check.state(ch not in self.s)
|
|
@@ -47,12 +47,12 @@ class DeployTag(abc.ABC): # noqa
|
|
|
47
47
|
def __init_subclass__(cls, **kwargs: ta.Any) -> None:
|
|
48
48
|
super().__init_subclass__(**kwargs)
|
|
49
49
|
|
|
50
|
-
if
|
|
50
|
+
if Abstract in cls.__bases__:
|
|
51
51
|
return
|
|
52
52
|
|
|
53
53
|
for b in cls.__bases__:
|
|
54
54
|
if issubclass(b, DeployTag):
|
|
55
|
-
check.in_(
|
|
55
|
+
check.in_(Abstract, b.__bases__)
|
|
56
56
|
|
|
57
57
|
check.non_empty_str(tn := cls.tag_name)
|
|
58
58
|
check.equal(tn, tn.lower().strip())
|
|
@@ -99,7 +99,7 @@ class DeployTime(DeployTag):
|
|
|
99
99
|
##
|
|
100
100
|
|
|
101
101
|
|
|
102
|
-
class NameDeployTag(DeployTag,
|
|
102
|
+
class NameDeployTag(DeployTag, Abstract):
|
|
103
103
|
pass
|
|
104
104
|
|
|
105
105
|
|
|
@@ -116,7 +116,7 @@ class DeployConf(NameDeployTag):
|
|
|
116
116
|
##
|
|
117
117
|
|
|
118
118
|
|
|
119
|
-
class KeyDeployTag(DeployTag,
|
|
119
|
+
class KeyDeployTag(DeployTag, Abstract):
|
|
120
120
|
pass
|
|
121
121
|
|
|
122
122
|
|
|
@@ -133,7 +133,7 @@ class DeployAppKey(KeyDeployTag):
|
|
|
133
133
|
##
|
|
134
134
|
|
|
135
135
|
|
|
136
|
-
class RevDeployTag(DeployTag,
|
|
136
|
+
class RevDeployTag(DeployTag, Abstract):
|
|
137
137
|
pass
|
|
138
138
|
|
|
139
139
|
|
ominfra/manage/inject.py
CHANGED
|
@@ -5,6 +5,7 @@ from omlish.lite.inject import InjectorBindingOrBindings
|
|
|
5
5
|
from omlish.lite.inject import InjectorBindings
|
|
6
6
|
from omlish.lite.inject import inj
|
|
7
7
|
from omlish.lite.marshal import ObjMarshalerManager
|
|
8
|
+
from omlish.lite.marshal import new_obj_marshaler_manager
|
|
8
9
|
|
|
9
10
|
from .bootstrap import MainBootstrap
|
|
10
11
|
from .commands.inject import bind_commands
|
|
@@ -63,7 +64,7 @@ def bind_main(
|
|
|
63
64
|
#
|
|
64
65
|
|
|
65
66
|
def build_obj_marshaler_manager(insts: ObjMarshalerInstallers) -> ObjMarshalerManager:
|
|
66
|
-
msh =
|
|
67
|
+
msh = new_obj_marshaler_manager()
|
|
67
68
|
inst: ObjMarshalerInstaller
|
|
68
69
|
for inst in insts:
|
|
69
70
|
inst.fn(msh)
|
ominfra/manage/main.py
CHANGED
|
@@ -8,7 +8,6 @@ import asyncio
|
|
|
8
8
|
import dataclasses as dc
|
|
9
9
|
import json
|
|
10
10
|
import os.path
|
|
11
|
-
import sys
|
|
12
11
|
import typing as ta
|
|
13
12
|
|
|
14
13
|
from omdev.home.paths import get_home_paths
|
|
@@ -18,10 +17,10 @@ from omlish.argparse.cli import argparse_cmd
|
|
|
18
17
|
from omlish.lite.cached import cached_nullary
|
|
19
18
|
from omlish.lite.check import check
|
|
20
19
|
from omlish.lite.configs import load_config_file_obj
|
|
21
|
-
from omlish.lite.logs import log # noqa
|
|
22
20
|
from omlish.lite.marshal import ObjMarshalerManager
|
|
23
21
|
from omlish.lite.marshal import ObjMarshalOptions
|
|
24
22
|
from omlish.lite.pycharm import PycharmRemoteDebug
|
|
23
|
+
from omlish.logs.modules import get_module_logger
|
|
25
24
|
|
|
26
25
|
from .bootstrap import MainBootstrap
|
|
27
26
|
from .bootstrap_ import main_bootstrap
|
|
@@ -33,6 +32,9 @@ from .targets.connection import ManageTargetConnector
|
|
|
33
32
|
from .targets.targets import ManageTarget
|
|
34
33
|
|
|
35
34
|
|
|
35
|
+
log = get_module_logger(globals()) # noqa
|
|
36
|
+
|
|
37
|
+
|
|
36
38
|
##
|
|
37
39
|
|
|
38
40
|
|
|
@@ -147,7 +149,7 @@ class MainCli(ArgparseCli):
|
|
|
147
149
|
|
|
148
150
|
|
|
149
151
|
def _main() -> None:
|
|
150
|
-
|
|
152
|
+
raise SystemExit(asyncio.run(MainCli().async_cli_run()))
|
|
151
153
|
|
|
152
154
|
|
|
153
155
|
if __name__ == '__main__':
|
ominfra/manage/remote/_main.py
CHANGED
|
@@ -13,9 +13,9 @@ from omlish.asyncs.asyncio.streams import asyncio_open_stream_writer
|
|
|
13
13
|
from omlish.lite.cached import cached_nullary
|
|
14
14
|
from omlish.lite.check import check
|
|
15
15
|
from omlish.lite.inject import Injector
|
|
16
|
-
from omlish.lite.logs import log
|
|
17
16
|
from omlish.lite.marshal import ObjMarshalerManager
|
|
18
17
|
from omlish.lite.pycharm import pycharm_debug_connect
|
|
18
|
+
from omlish.logs.modules import get_module_logger
|
|
19
19
|
from omlish.os.deathsig import set_process_deathsig
|
|
20
20
|
|
|
21
21
|
from ...pyremote import pyremote_bootstrap_finalize
|
|
@@ -33,12 +33,16 @@ else:
|
|
|
33
33
|
main_bootstrap: ta.Any = None
|
|
34
34
|
|
|
35
35
|
|
|
36
|
+
log = get_module_logger(globals()) # noqa
|
|
37
|
+
|
|
38
|
+
|
|
36
39
|
##
|
|
37
40
|
|
|
38
41
|
|
|
39
42
|
class _RemoteExecutionLogHandler(logging.Handler):
|
|
40
43
|
def __init__(self, fn: ta.Callable[[str], None]) -> None:
|
|
41
44
|
super().__init__()
|
|
45
|
+
|
|
42
46
|
self._fn = fn
|
|
43
47
|
|
|
44
48
|
def emit(self, record):
|
ominfra/manage/remote/channel.py
CHANGED
|
@@ -5,6 +5,7 @@ import json
|
|
|
5
5
|
import struct
|
|
6
6
|
import typing as ta
|
|
7
7
|
|
|
8
|
+
from omlish.lite.abstract import Abstract
|
|
8
9
|
from omlish.lite.json import json_dumps_compact
|
|
9
10
|
from omlish.lite.marshal import OBJ_MARSHALER_MANAGER
|
|
10
11
|
from omlish.lite.marshal import ObjMarshalerManager
|
|
@@ -16,7 +17,7 @@ T = ta.TypeVar('T')
|
|
|
16
17
|
##
|
|
17
18
|
|
|
18
19
|
|
|
19
|
-
class RemoteChannel(
|
|
20
|
+
class RemoteChannel(Abstract):
|
|
20
21
|
@abc.abstractmethod
|
|
21
22
|
def send_obj(self, o: ta.Any, ty: ta.Any = None) -> ta.Awaitable[None]:
|
|
22
23
|
raise NotImplementedError
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
TODO:
|
|
4
4
|
- sequence all messages
|
|
5
5
|
"""
|
|
6
|
-
import abc
|
|
7
6
|
import asyncio
|
|
8
7
|
import dataclasses as dc
|
|
9
8
|
import itertools
|
|
@@ -11,8 +10,10 @@ import logging
|
|
|
11
10
|
import time
|
|
12
11
|
import typing as ta
|
|
13
12
|
|
|
13
|
+
from omlish.lite.abstract import Abstract
|
|
14
14
|
from omlish.lite.check import check
|
|
15
|
-
from omlish.
|
|
15
|
+
from omlish.logs.modules import get_module_logger
|
|
16
|
+
from omlish.logs.protocols import LoggerLike
|
|
16
17
|
|
|
17
18
|
from ..commands.base import Command
|
|
18
19
|
from ..commands.base import CommandException
|
|
@@ -25,11 +26,14 @@ from .channel import RemoteChannel
|
|
|
25
26
|
T = ta.TypeVar('T')
|
|
26
27
|
|
|
27
28
|
|
|
29
|
+
log = get_module_logger(globals()) # noqa
|
|
30
|
+
|
|
31
|
+
|
|
28
32
|
##
|
|
29
33
|
|
|
30
34
|
|
|
31
35
|
class _RemoteProtocol:
|
|
32
|
-
class Message(
|
|
36
|
+
class Message(Abstract):
|
|
33
37
|
async def send(self, chan: RemoteChannel) -> None:
|
|
34
38
|
await chan.send_obj(self, _RemoteProtocol.Message)
|
|
35
39
|
|
|
@@ -39,7 +43,7 @@ class _RemoteProtocol:
|
|
|
39
43
|
|
|
40
44
|
#
|
|
41
45
|
|
|
42
|
-
class Request(Message,
|
|
46
|
+
class Request(Message, Abstract):
|
|
43
47
|
pass
|
|
44
48
|
|
|
45
49
|
@dc.dataclass(frozen=True)
|
|
@@ -53,7 +57,7 @@ class _RemoteProtocol:
|
|
|
53
57
|
|
|
54
58
|
#
|
|
55
59
|
|
|
56
|
-
class Response(Message,
|
|
60
|
+
class Response(Message, Abstract):
|
|
57
61
|
pass
|
|
58
62
|
|
|
59
63
|
@dc.dataclass(frozen=True)
|
|
@@ -394,7 +398,7 @@ class RemoteCommandExecutor(CommandExecutor):
|
|
|
394
398
|
self,
|
|
395
399
|
cmd: Command,
|
|
396
400
|
*,
|
|
397
|
-
log: ta.Optional[
|
|
401
|
+
log: ta.Optional[LoggerLike] = None, # noqa
|
|
398
402
|
omit_exc_object: bool = False,
|
|
399
403
|
) -> CommandOutputOrException:
|
|
400
404
|
try:
|
|
@@ -8,6 +8,7 @@ import subprocess
|
|
|
8
8
|
import typing as ta
|
|
9
9
|
|
|
10
10
|
from omlish.asyncs.asyncio.subprocesses import asyncio_subprocesses
|
|
11
|
+
from omlish.lite.abstract import Abstract
|
|
11
12
|
from omlish.lite.check import check
|
|
12
13
|
from omlish.shlex import shlex_maybe_quote
|
|
13
14
|
from omlish.subprocesses.base import SUBPROCESS_CHANNEL_OPTION_VALUES
|
|
@@ -17,7 +18,7 @@ from omlish.subprocesses.base import SubprocessChannelOption
|
|
|
17
18
|
##
|
|
18
19
|
|
|
19
20
|
|
|
20
|
-
class RemoteSpawning(
|
|
21
|
+
class RemoteSpawning(Abstract):
|
|
21
22
|
@dc.dataclass(frozen=True)
|
|
22
23
|
class Target:
|
|
23
24
|
shell: ta.Optional[str] = None
|
|
@@ -3,7 +3,7 @@ import dataclasses as dc
|
|
|
3
3
|
import typing as ta
|
|
4
4
|
|
|
5
5
|
from omlish.lite.check import check
|
|
6
|
-
from omlish.
|
|
6
|
+
from omlish.logs.modules import get_module_logger
|
|
7
7
|
|
|
8
8
|
from ..commands.base import Command
|
|
9
9
|
from ..commands.base import CommandExecutor
|
|
@@ -11,6 +11,9 @@ from .packages import SystemPackage
|
|
|
11
11
|
from .packages import SystemPackageManager
|
|
12
12
|
|
|
13
13
|
|
|
14
|
+
log = get_module_logger(globals()) # noqa
|
|
15
|
+
|
|
16
|
+
|
|
14
17
|
##
|
|
15
18
|
|
|
16
19
|
|
|
@@ -10,6 +10,7 @@ import os
|
|
|
10
10
|
import typing as ta
|
|
11
11
|
|
|
12
12
|
from omlish.asyncs.asyncio.subprocesses import asyncio_subprocesses
|
|
13
|
+
from omlish.lite.abstract import Abstract
|
|
13
14
|
from omlish.lite.check import check
|
|
14
15
|
|
|
15
16
|
|
|
@@ -25,7 +26,7 @@ class SystemPackage:
|
|
|
25
26
|
version: ta.Optional[str] = None
|
|
26
27
|
|
|
27
28
|
|
|
28
|
-
class SystemPackageManager(
|
|
29
|
+
class SystemPackageManager(Abstract):
|
|
29
30
|
@abc.abstractmethod
|
|
30
31
|
def update(self) -> ta.Awaitable[None]:
|
|
31
32
|
raise NotImplementedError
|
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
import abc
|
|
2
1
|
import dataclasses as dc
|
|
3
2
|
import sys
|
|
4
3
|
|
|
4
|
+
from omlish.lite.abstract import Abstract
|
|
5
5
|
from omlish.lite.cached import cached_nullary
|
|
6
|
-
from omlish.
|
|
6
|
+
from omlish.logs.modules import get_module_logger
|
|
7
7
|
from omlish.os.linux import LinuxOsRelease
|
|
8
8
|
|
|
9
9
|
|
|
10
|
+
log = get_module_logger(globals()) # noqa
|
|
11
|
+
|
|
12
|
+
|
|
10
13
|
##
|
|
11
14
|
|
|
12
15
|
|
|
13
16
|
@dc.dataclass(frozen=True)
|
|
14
|
-
class Platform(
|
|
17
|
+
class Platform(Abstract):
|
|
15
18
|
pass
|
|
16
19
|
|
|
17
20
|
|
|
18
|
-
class LinuxPlatform(Platform,
|
|
21
|
+
class LinuxPlatform(Platform, Abstract):
|
|
19
22
|
pass
|
|
20
23
|
|
|
21
24
|
|
|
@@ -4,6 +4,7 @@ import contextlib
|
|
|
4
4
|
import dataclasses as dc
|
|
5
5
|
import typing as ta
|
|
6
6
|
|
|
7
|
+
from omlish.lite.abstract import Abstract
|
|
7
8
|
from omlish.lite.check import check
|
|
8
9
|
|
|
9
10
|
from ..bootstrap import MainBootstrap
|
|
@@ -24,7 +25,7 @@ from .targets import SubprocessManageTarget
|
|
|
24
25
|
##
|
|
25
26
|
|
|
26
27
|
|
|
27
|
-
class ManageTargetConnector(
|
|
28
|
+
class ManageTargetConnector(Abstract):
|
|
28
29
|
@abc.abstractmethod
|
|
29
30
|
def connect(self, tgt: ManageTarget) -> ta.AsyncContextManager[CommandExecutor]:
|
|
30
31
|
raise NotImplementedError
|
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
It's desugaring. Subprocess and locals are only leafs. Retain an origin?
|
|
4
4
|
** TWO LAYERS ** - ManageTarget is user-facing, ConnectorTarget is bound, internal
|
|
5
5
|
"""
|
|
6
|
-
import abc
|
|
7
6
|
import dataclasses as dc
|
|
8
7
|
import enum
|
|
9
8
|
import typing as ta
|
|
10
9
|
|
|
10
|
+
from omlish.lite.abstract import Abstract
|
|
11
11
|
from omlish.lite.check import check
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
##
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
class ManageTarget(
|
|
17
|
+
class ManageTarget(Abstract):
|
|
18
18
|
def __init_subclass__(cls, **kwargs: ta.Any) -> None:
|
|
19
19
|
super().__init_subclass__(**kwargs)
|
|
20
20
|
|
|
@@ -36,15 +36,15 @@ class PythonRemoteManageTarget:
|
|
|
36
36
|
#
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
class RemoteManageTarget(ManageTarget,
|
|
39
|
+
class RemoteManageTarget(ManageTarget, Abstract):
|
|
40
40
|
pass
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
class PhysicallyRemoteManageTarget(RemoteManageTarget,
|
|
43
|
+
class PhysicallyRemoteManageTarget(RemoteManageTarget, Abstract):
|
|
44
44
|
pass
|
|
45
45
|
|
|
46
46
|
|
|
47
|
-
class LocalManageTarget(ManageTarget,
|
|
47
|
+
class LocalManageTarget(ManageTarget, Abstract):
|
|
48
48
|
pass
|
|
49
49
|
|
|
50
50
|
|