refactor: verplaats run() duplicaat naar common.py
run() stond identiek in app.py en app_system.py. Verplaatst naar common.py als single source of truth; beide modules importeren nu de centrale versie. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,17 @@
|
||||
import subprocess
|
||||
|
||||
from fastapi import HTTPException
|
||||
|
||||
|
||||
def run(cmd):
|
||||
try:
|
||||
result = subprocess.run(cmd, capture_output=True, text=True, check=False)
|
||||
output = (result.stdout or "") + (result.stderr or "")
|
||||
return result.returncode, output.strip()
|
||||
except Exception as e:
|
||||
return 1, str(e)
|
||||
|
||||
|
||||
def _podman_get_json_checked(session, url: str):
|
||||
r = session.get(url)
|
||||
if r.status_code >= 400:
|
||||
|
||||
Reference in New Issue
Block a user