🥊 add vagrant support to exec subcommand

This commit is contained in:
Michael Pöhn 2025-10-08 17:21:53 +02:00 committed by Hans-Christoph Steiner
parent 63660e1aed
commit 60f5f8fa1c

View file

@ -5183,6 +5183,23 @@ def get_vagrantfile_path(appid, vercode):
def vagrant_exec(appid, vercode, command): def vagrant_exec(appid, vercode, command):
"""Execute a command in the Vagrant VM via ssh.""" """Execute a command in the Vagrant VM via ssh."""
vagrantfile = get_vagrantfile_path(appid, vercode)
to_stdin = shlex.join(command)
p = subprocess.run(
[
'vagrant',
'ssh',
'-c',
'bash',
],
input=to_stdin,
text=True,
cwd=vagrantfile.parent,
)
if p.returncode != 0:
raise subprocess.CalledProcessError(
p.returncode, f"{to_stdin} | {' '.join(p.args)}"
)
def vagrant_destroy(appid, vercode): def vagrant_destroy(appid, vercode):