ominfra 0.0.0.dev135__tar.gz → 0.0.0.dev137__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {ominfra-0.0.0.dev135/ominfra.egg-info → ominfra-0.0.0.dev137}/PKG-INFO +3 -3
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/new/_manage.py +61 -28
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/new/main.py +48 -23
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/pyremote.py +14 -6
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137/ominfra.egg-info}/PKG-INFO +3 -3
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra.egg-info/requires.txt +2 -2
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/pyproject.toml +3 -3
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/LICENSE +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/MANIFEST.in +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/README.rst +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/.manifests.json +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/__about__.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/__init__.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/clouds/__init__.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/clouds/aws/__init__.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/clouds/aws/__main__.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/clouds/aws/auth.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/clouds/aws/cli.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/clouds/aws/dataclasses.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/clouds/aws/journald2aws/__init__.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/clouds/aws/journald2aws/__main__.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/clouds/aws/journald2aws/cursor.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/clouds/aws/journald2aws/driver.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/clouds/aws/journald2aws/main.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/clouds/aws/journald2aws/poster.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/clouds/aws/logs.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/clouds/aws/metadata.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/clouds/gcp/__init__.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/clouds/gcp/auth.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/cmds.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/configs.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/journald/__init__.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/journald/fields.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/journald/genmessages.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/journald/messages.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/journald/tailer.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/__init__.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/deploy/__init__.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/deploy/_executor.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/deploy/configs.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/deploy/executor/__init__.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/deploy/executor/base.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/deploy/executor/concerns/__init__.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/deploy/executor/concerns/dirs.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/deploy/executor/concerns/nginx.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/deploy/executor/concerns/repo.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/deploy/executor/concerns/supervisor.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/deploy/executor/concerns/systemd.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/deploy/executor/concerns/user.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/deploy/executor/concerns/venv.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/deploy/executor/main.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/deploy/poly/__init__.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/deploy/poly/_main.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/deploy/poly/base.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/deploy/poly/configs.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/deploy/poly/deploy.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/deploy/poly/main.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/deploy/poly/nginx.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/deploy/poly/repo.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/deploy/poly/runtime.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/deploy/poly/site.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/deploy/poly/supervisor.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/deploy/poly/venv.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/deploy/remote.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/manage.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/new/__init__.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/new/commands/__init__.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/new/commands/base.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/new/commands/subprocess.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/scripts/__init__.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/scripts/journald2aws.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/scripts/supervisor.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/ssh.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/supervisor/LICENSE.txt +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/supervisor/__init__.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/supervisor/__main__.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/supervisor/configs.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/supervisor/dispatchers.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/supervisor/dispatchersimpl.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/supervisor/events.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/supervisor/exceptions.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/supervisor/groups.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/supervisor/groupsimpl.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/supervisor/http.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/supervisor/inject.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/supervisor/io.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/supervisor/main.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/supervisor/pipes.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/supervisor/privileges.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/supervisor/process.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/supervisor/processimpl.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/supervisor/setup.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/supervisor/setupimpl.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/supervisor/signals.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/supervisor/spawning.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/supervisor/spawningimpl.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/supervisor/states.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/supervisor/supervisor.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/supervisor/types.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/supervisor/utils/__init__.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/supervisor/utils/collections.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/supervisor/utils/diag.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/supervisor/utils/fds.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/supervisor/utils/fs.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/supervisor/utils/os.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/supervisor/utils/ostypes.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/supervisor/utils/signals.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/supervisor/utils/strings.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/supervisor/utils/users.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/tailscale/__init__.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/tailscale/api.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/tailscale/cli.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/threadworkers.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/tools/__init__.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/tools/listresources.py +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra.egg-info/SOURCES.txt +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra.egg-info/dependency_links.txt +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra.egg-info/entry_points.txt +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra.egg-info/top_level.txt +0 -0
- {ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ominfra
|
3
|
-
Version: 0.0.0.
|
3
|
+
Version: 0.0.0.dev137
|
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.dev137
|
16
|
+
Requires-Dist: omlish==0.0.0.dev137
|
17
17
|
Provides-Extra: all
|
18
18
|
Requires-Dist: paramiko~=3.5; extra == "all"
|
19
19
|
Requires-Dist: asyncssh~=2.18; extra == "all"
|
@@ -87,10 +87,10 @@ Basically this: https://mitogen.networkgenomics.com/howitworks.html
|
|
87
87
|
##
|
88
88
|
|
89
89
|
|
90
|
-
|
90
|
+
_PYREMOTE_BOOTSTRAP_INPUT_FD = 100
|
91
91
|
_PYREMOTE_BOOTSTRAP_SRC_FD = 101
|
92
92
|
|
93
|
-
_PYREMOTE_BOOTSTRAP_CHILD_PID_VAR = '
|
93
|
+
_PYREMOTE_BOOTSTRAP_CHILD_PID_VAR = '_OPYR_CHILD_PID'
|
94
94
|
_PYREMOTE_BOOTSTRAP_ARGV0_VAR = '_OPYR_ARGV0'
|
95
95
|
|
96
96
|
_PYREMOTE_BOOTSTRAP_ACK0 = b'OPYR000\n'
|
@@ -121,7 +121,7 @@ def _pyremote_bootstrap_main(context_name: str) -> None:
|
|
121
121
|
# Parent process
|
122
122
|
|
123
123
|
# Dup original stdin to comm_fd for use as comm channel
|
124
|
-
os.dup2(0,
|
124
|
+
os.dup2(0, _PYREMOTE_BOOTSTRAP_INPUT_FD)
|
125
125
|
|
126
126
|
# Overwrite stdin (fed to python repl) with first copy of src
|
127
127
|
os.dup2(r0, 0)
|
@@ -179,7 +179,7 @@ def pyremote_build_bootstrap_cmd(context_name: str) -> str:
|
|
179
179
|
bs_src = textwrap.dedent(inspect.getsource(_pyremote_bootstrap_main))
|
180
180
|
|
181
181
|
for gl in [
|
182
|
-
'
|
182
|
+
'_PYREMOTE_BOOTSTRAP_INPUT_FD',
|
183
183
|
'_PYREMOTE_BOOTSTRAP_SRC_FD',
|
184
184
|
|
185
185
|
'_PYREMOTE_BOOTSTRAP_CHILD_PID_VAR',
|
@@ -424,6 +424,7 @@ class PyremoteBootstrapDriver:
|
|
424
424
|
@dc.dataclass(frozen=True)
|
425
425
|
class PyremotePayloadRuntime:
|
426
426
|
input: ta.BinaryIO
|
427
|
+
output: ta.BinaryIO
|
427
428
|
main_src: str
|
428
429
|
env_info: PyremoteEnvInfo
|
429
430
|
|
@@ -450,12 +451,19 @@ def pyremote_bootstrap_finalize() -> PyremotePayloadRuntime:
|
|
450
451
|
os.write(1, struct.pack('<I', len(env_info_json)))
|
451
452
|
os.write(1, env_info_json.encode('utf-8'))
|
452
453
|
|
454
|
+
# Setup IO
|
455
|
+
input = os.fdopen(_PYREMOTE_BOOTSTRAP_INPUT_FD, 'rb', 0) # noqa
|
456
|
+
output = os.fdopen(os.dup(1), 'wb', 0) # noqa
|
457
|
+
os.dup2(nfd := os.open('/dev/null', os.O_WRONLY), 1)
|
458
|
+
os.close(nfd)
|
459
|
+
|
453
460
|
# Write fourth ack
|
454
|
-
|
461
|
+
output.write(_PYREMOTE_BOOTSTRAP_ACK3)
|
455
462
|
|
456
463
|
# Return
|
457
464
|
return PyremotePayloadRuntime(
|
458
|
-
input=
|
465
|
+
input=input,
|
466
|
+
output=output,
|
459
467
|
main_src=main_src,
|
460
468
|
env_info=env_info,
|
461
469
|
)
|
@@ -1526,6 +1534,9 @@ def _recv_obj(f: ta.IO, ty: type) -> ta.Any:
|
|
1526
1534
|
return unmarshal_obj(j, ty)
|
1527
1535
|
|
1528
1536
|
|
1537
|
+
##
|
1538
|
+
|
1539
|
+
|
1529
1540
|
def _remote_main() -> None:
|
1530
1541
|
rt = pyremote_bootstrap_finalize() # noqa
|
1531
1542
|
|
@@ -1536,7 +1547,42 @@ def _remote_main() -> None:
|
|
1536
1547
|
|
1537
1548
|
o = SubprocessCommand()._execute(i) # noqa
|
1538
1549
|
|
1539
|
-
_send_obj(
|
1550
|
+
_send_obj(rt.output, o)
|
1551
|
+
|
1552
|
+
|
1553
|
+
##
|
1554
|
+
|
1555
|
+
|
1556
|
+
@cached_nullary
|
1557
|
+
def _get_self_src() -> str:
|
1558
|
+
return inspect.getsource(sys.modules[__name__])
|
1559
|
+
|
1560
|
+
|
1561
|
+
def _is_src_amalg(src: str) -> bool:
|
1562
|
+
for l in src.splitlines(): # noqa
|
1563
|
+
if l.startswith('# @omlish-amalg-output '):
|
1564
|
+
return True
|
1565
|
+
return False
|
1566
|
+
|
1567
|
+
|
1568
|
+
@cached_nullary
|
1569
|
+
def _is_self_amalg() -> bool:
|
1570
|
+
return _is_src_amalg(_get_self_src())
|
1571
|
+
|
1572
|
+
|
1573
|
+
def _get_amalg_src(*, amalg_file: ta.Optional[str]) -> str:
|
1574
|
+
if amalg_file is not None:
|
1575
|
+
with open(amalg_file) as f:
|
1576
|
+
return f.read()
|
1577
|
+
|
1578
|
+
if _is_self_amalg():
|
1579
|
+
return _get_self_src()
|
1580
|
+
|
1581
|
+
import importlib.resources
|
1582
|
+
return importlib.resources.read_text(__package__, '_manage.py')
|
1583
|
+
|
1584
|
+
|
1585
|
+
##
|
1540
1586
|
|
1541
1587
|
|
1542
1588
|
def _main() -> None:
|
@@ -1544,7 +1590,8 @@ def _main() -> None:
|
|
1544
1590
|
|
1545
1591
|
parser = argparse.ArgumentParser()
|
1546
1592
|
|
1547
|
-
parser.add_argument('--
|
1593
|
+
parser.add_argument('-s', '--shell')
|
1594
|
+
parser.add_argument('-q', '--shell-quote', action='store_true')
|
1548
1595
|
parser.add_argument('--python', default='python3')
|
1549
1596
|
parser.add_argument('--_amalg-file')
|
1550
1597
|
|
@@ -1552,23 +1599,7 @@ def _main() -> None:
|
|
1552
1599
|
|
1553
1600
|
#
|
1554
1601
|
|
1555
|
-
|
1556
|
-
self_src_lines = self_src.splitlines()
|
1557
|
-
for l in self_src_lines:
|
1558
|
-
if l.startswith('# @omlish-amalg-output '):
|
1559
|
-
is_self_amalg = True
|
1560
|
-
break
|
1561
|
-
else:
|
1562
|
-
is_self_amalg = False
|
1563
|
-
|
1564
|
-
if is_self_amalg:
|
1565
|
-
amalg_src = self_src
|
1566
|
-
else:
|
1567
|
-
amalg_file = args._amalg_file # noqa
|
1568
|
-
if amalg_file is None:
|
1569
|
-
amalg_file = os.path.join(os.path.dirname(__file__), '_manage.py')
|
1570
|
-
with open(amalg_file) as f:
|
1571
|
-
amalg_src = f.read()
|
1602
|
+
amalg_src = _get_amalg_src(amalg_file=args._amalg_file) # noqa
|
1572
1603
|
|
1573
1604
|
#
|
1574
1605
|
|
@@ -1582,9 +1613,11 @@ def _main() -> None:
|
|
1582
1613
|
|
1583
1614
|
bs_src = pyremote_build_bootstrap_cmd(__package__ or 'manage')
|
1584
1615
|
|
1585
|
-
if args.
|
1586
|
-
sh_src = '
|
1587
|
-
|
1616
|
+
if args.shell is not None:
|
1617
|
+
sh_src = f'{args.python} -c {shlex.quote(bs_src)}'
|
1618
|
+
if args.shell_quote:
|
1619
|
+
sh_src = shlex.quote(sh_src)
|
1620
|
+
sh_cmd = f'{args.shell} {sh_src}'
|
1588
1621
|
cmd = [sh_cmd]
|
1589
1622
|
shell = True
|
1590
1623
|
else:
|
@@ -3,13 +3,13 @@
|
|
3
3
|
# ruff: noqa: UP006 UP007
|
4
4
|
import inspect
|
5
5
|
import json
|
6
|
-
import os
|
7
6
|
import shlex
|
8
7
|
import struct
|
9
8
|
import subprocess
|
10
9
|
import sys
|
11
10
|
import typing as ta
|
12
11
|
|
12
|
+
from omlish.lite.cached import cached_nullary
|
13
13
|
from omlish.lite.check import check_not_none
|
14
14
|
from omlish.lite.json import json_dumps_compact
|
15
15
|
from omlish.lite.marshal import marshal_obj
|
@@ -50,6 +50,9 @@ def _recv_obj(f: ta.IO, ty: type) -> ta.Any:
|
|
50
50
|
return unmarshal_obj(j, ty)
|
51
51
|
|
52
52
|
|
53
|
+
##
|
54
|
+
|
55
|
+
|
53
56
|
def _remote_main() -> None:
|
54
57
|
rt = pyremote_bootstrap_finalize() # noqa
|
55
58
|
|
@@ -60,7 +63,42 @@ def _remote_main() -> None:
|
|
60
63
|
|
61
64
|
o = SubprocessCommand()._execute(i) # noqa
|
62
65
|
|
63
|
-
_send_obj(
|
66
|
+
_send_obj(rt.output, o)
|
67
|
+
|
68
|
+
|
69
|
+
##
|
70
|
+
|
71
|
+
|
72
|
+
@cached_nullary
|
73
|
+
def _get_self_src() -> str:
|
74
|
+
return inspect.getsource(sys.modules[__name__])
|
75
|
+
|
76
|
+
|
77
|
+
def _is_src_amalg(src: str) -> bool:
|
78
|
+
for l in src.splitlines(): # noqa
|
79
|
+
if l.startswith('# @omlish-amalg-output '):
|
80
|
+
return True
|
81
|
+
return False
|
82
|
+
|
83
|
+
|
84
|
+
@cached_nullary
|
85
|
+
def _is_self_amalg() -> bool:
|
86
|
+
return _is_src_amalg(_get_self_src())
|
87
|
+
|
88
|
+
|
89
|
+
def _get_amalg_src(*, amalg_file: ta.Optional[str]) -> str:
|
90
|
+
if amalg_file is not None:
|
91
|
+
with open(amalg_file) as f:
|
92
|
+
return f.read()
|
93
|
+
|
94
|
+
if _is_self_amalg():
|
95
|
+
return _get_self_src()
|
96
|
+
|
97
|
+
import importlib.resources
|
98
|
+
return importlib.resources.read_text(__package__, '_manage.py')
|
99
|
+
|
100
|
+
|
101
|
+
##
|
64
102
|
|
65
103
|
|
66
104
|
def _main() -> None:
|
@@ -68,7 +106,8 @@ def _main() -> None:
|
|
68
106
|
|
69
107
|
parser = argparse.ArgumentParser()
|
70
108
|
|
71
|
-
parser.add_argument('--
|
109
|
+
parser.add_argument('-s', '--shell')
|
110
|
+
parser.add_argument('-q', '--shell-quote', action='store_true')
|
72
111
|
parser.add_argument('--python', default='python3')
|
73
112
|
parser.add_argument('--_amalg-file')
|
74
113
|
|
@@ -76,23 +115,7 @@ def _main() -> None:
|
|
76
115
|
|
77
116
|
#
|
78
117
|
|
79
|
-
|
80
|
-
self_src_lines = self_src.splitlines()
|
81
|
-
for l in self_src_lines:
|
82
|
-
if l.startswith('# @omlish-amalg-output '):
|
83
|
-
is_self_amalg = True
|
84
|
-
break
|
85
|
-
else:
|
86
|
-
is_self_amalg = False
|
87
|
-
|
88
|
-
if is_self_amalg:
|
89
|
-
amalg_src = self_src
|
90
|
-
else:
|
91
|
-
amalg_file = args._amalg_file # noqa
|
92
|
-
if amalg_file is None:
|
93
|
-
amalg_file = os.path.join(os.path.dirname(__file__), '_manage.py')
|
94
|
-
with open(amalg_file) as f:
|
95
|
-
amalg_src = f.read()
|
118
|
+
amalg_src = _get_amalg_src(amalg_file=args._amalg_file) # noqa
|
96
119
|
|
97
120
|
#
|
98
121
|
|
@@ -106,9 +129,11 @@ def _main() -> None:
|
|
106
129
|
|
107
130
|
bs_src = pyremote_build_bootstrap_cmd(__package__ or 'manage')
|
108
131
|
|
109
|
-
if args.
|
110
|
-
sh_src = '
|
111
|
-
|
132
|
+
if args.shell is not None:
|
133
|
+
sh_src = f'{args.python} -c {shlex.quote(bs_src)}'
|
134
|
+
if args.shell_quote:
|
135
|
+
sh_src = shlex.quote(sh_src)
|
136
|
+
sh_cmd = f'{args.shell} {sh_src}'
|
112
137
|
cmd = [sh_cmd]
|
113
138
|
shell = True
|
114
139
|
else:
|
@@ -21,10 +21,10 @@ import zlib
|
|
21
21
|
##
|
22
22
|
|
23
23
|
|
24
|
-
|
24
|
+
_PYREMOTE_BOOTSTRAP_INPUT_FD = 100
|
25
25
|
_PYREMOTE_BOOTSTRAP_SRC_FD = 101
|
26
26
|
|
27
|
-
_PYREMOTE_BOOTSTRAP_CHILD_PID_VAR = '
|
27
|
+
_PYREMOTE_BOOTSTRAP_CHILD_PID_VAR = '_OPYR_CHILD_PID'
|
28
28
|
_PYREMOTE_BOOTSTRAP_ARGV0_VAR = '_OPYR_ARGV0'
|
29
29
|
|
30
30
|
_PYREMOTE_BOOTSTRAP_ACK0 = b'OPYR000\n'
|
@@ -55,7 +55,7 @@ def _pyremote_bootstrap_main(context_name: str) -> None:
|
|
55
55
|
# Parent process
|
56
56
|
|
57
57
|
# Dup original stdin to comm_fd for use as comm channel
|
58
|
-
os.dup2(0,
|
58
|
+
os.dup2(0, _PYREMOTE_BOOTSTRAP_INPUT_FD)
|
59
59
|
|
60
60
|
# Overwrite stdin (fed to python repl) with first copy of src
|
61
61
|
os.dup2(r0, 0)
|
@@ -113,7 +113,7 @@ def pyremote_build_bootstrap_cmd(context_name: str) -> str:
|
|
113
113
|
bs_src = textwrap.dedent(inspect.getsource(_pyremote_bootstrap_main))
|
114
114
|
|
115
115
|
for gl in [
|
116
|
-
'
|
116
|
+
'_PYREMOTE_BOOTSTRAP_INPUT_FD',
|
117
117
|
'_PYREMOTE_BOOTSTRAP_SRC_FD',
|
118
118
|
|
119
119
|
'_PYREMOTE_BOOTSTRAP_CHILD_PID_VAR',
|
@@ -358,6 +358,7 @@ class PyremoteBootstrapDriver:
|
|
358
358
|
@dc.dataclass(frozen=True)
|
359
359
|
class PyremotePayloadRuntime:
|
360
360
|
input: ta.BinaryIO
|
361
|
+
output: ta.BinaryIO
|
361
362
|
main_src: str
|
362
363
|
env_info: PyremoteEnvInfo
|
363
364
|
|
@@ -384,12 +385,19 @@ def pyremote_bootstrap_finalize() -> PyremotePayloadRuntime:
|
|
384
385
|
os.write(1, struct.pack('<I', len(env_info_json)))
|
385
386
|
os.write(1, env_info_json.encode('utf-8'))
|
386
387
|
|
388
|
+
# Setup IO
|
389
|
+
input = os.fdopen(_PYREMOTE_BOOTSTRAP_INPUT_FD, 'rb', 0) # noqa
|
390
|
+
output = os.fdopen(os.dup(1), 'wb', 0) # noqa
|
391
|
+
os.dup2(nfd := os.open('/dev/null', os.O_WRONLY), 1)
|
392
|
+
os.close(nfd)
|
393
|
+
|
387
394
|
# Write fourth ack
|
388
|
-
|
395
|
+
output.write(_PYREMOTE_BOOTSTRAP_ACK3)
|
389
396
|
|
390
397
|
# Return
|
391
398
|
return PyremotePayloadRuntime(
|
392
|
-
input=
|
399
|
+
input=input,
|
400
|
+
output=output,
|
393
401
|
main_src=main_src,
|
394
402
|
env_info=env_info,
|
395
403
|
)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ominfra
|
3
|
-
Version: 0.0.0.
|
3
|
+
Version: 0.0.0.dev137
|
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.dev137
|
16
|
+
Requires-Dist: omlish==0.0.0.dev137
|
17
17
|
Provides-Extra: all
|
18
18
|
Requires-Dist: paramiko~=3.5; extra == "all"
|
19
19
|
Requires-Dist: asyncssh~=2.18; extra == "all"
|
@@ -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.
|
15
|
+
version = '0.0.0.dev137'
|
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.
|
26
|
-
'omlish == 0.0.0.
|
25
|
+
'omdev == 0.0.0.dev137',
|
26
|
+
'omlish == 0.0.0.dev137',
|
27
27
|
]
|
28
28
|
|
29
29
|
[project.optional-dependencies]
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/deploy/executor/concerns/__init__.py
RENAMED
File without changes
|
{ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/deploy/executor/concerns/dirs.py
RENAMED
File without changes
|
{ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/deploy/executor/concerns/nginx.py
RENAMED
File without changes
|
{ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/deploy/executor/concerns/repo.py
RENAMED
File without changes
|
{ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/deploy/executor/concerns/supervisor.py
RENAMED
File without changes
|
{ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/deploy/executor/concerns/systemd.py
RENAMED
File without changes
|
{ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/deploy/executor/concerns/user.py
RENAMED
File without changes
|
{ominfra-0.0.0.dev135 → ominfra-0.0.0.dev137}/ominfra/manage/deploy/executor/concerns/venv.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|