mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-09 12:17:13 +00:00
Move:
- cli/build/inventory/full -> cli/administration/inventory/devices
- cli/create/inventory -> cli/administration/inventory/provision
- cli/create/credentials -> cli/administration/inventory/credentials
- cli/encrypt/inventory -> cli/administration/inventory/encrypt
Delete:
- cli/create/role + templates/roles/ (stale scaffolder)
- roles/web-app-baserow/templates/javascript.js.j2 + dead sso_warning snippet
- js_application_name across akaunting/baserow/opencloud/opentalk/taiga,
javascript service disabled for baserow + taiga
Wire-through:
- argv lists in cli/deploy/{container,development}/* + 2 shell scripts
now invoke 'infinito administration inventory provision'
- subprocess module names + docs (contributing/* + administration/deploy.md)
- discovery resolver test + folder-item-limit whitelist updated
- ruff fixes in devices/command.py (RET504 inline + Path.open over open)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
29 lines
800 B
Python
29 lines
800 B
Python
from __future__ import annotations
|
|
|
|
import subprocess
|
|
|
|
|
|
def run_subprocess(
|
|
cmd: list[str],
|
|
capture_output: bool = False,
|
|
env: dict[str, str] | None = None,
|
|
) -> subprocess.CompletedProcess:
|
|
"""
|
|
Run a subprocess command and either stream output or capture it.
|
|
Raise SystemExit on non-zero return code.
|
|
"""
|
|
if capture_output:
|
|
result = subprocess.run(
|
|
cmd, text=True, capture_output=True, env=env, check=False
|
|
)
|
|
else:
|
|
result = subprocess.run(cmd, text=True, env=env, check=False)
|
|
|
|
if result.returncode != 0:
|
|
msg = f"Command failed: {' '.join(str(c) for c in cmd)}\n"
|
|
if capture_output:
|
|
msg += f"STDOUT:\n{result.stdout}\nSTDERR:\n{result.stderr}\n"
|
|
raise SystemExit(msg)
|
|
|
|
return result
|