From 11c80124af75035ffb240963ea67f3db3d39f936 Mon Sep 17 00:00:00 2001 From: Dmitrii Iurco Date: Wed, 22 Apr 2026 14:28:13 -0400 Subject: [PATCH] fix: subprocess not imported in _do_apply background thread MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The apply_pending_config endpoint spawns _do_apply in a background thread. subprocess was used but not imported inside the closure, causing NameError: name 'subprocess' is not defined on every Apply click — silently swallowed, so containers never restarted and no error was shown. Co-Authored-By: Claude Sonnet 4.6 --- api/app.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/api/app.py b/api/app.py index 9e74f3c..07507de 100644 --- a/api/app.py +++ b/api/app.py @@ -712,15 +712,16 @@ def apply_pending_config(): # Run in a background thread; 0.3 s delay lets Flask send this response first. def _do_apply(): import time as _time + import subprocess as _subprocess _time.sleep(0.3) if compose_down_args: - r = subprocess.run(base_cmd + compose_down_args, - capture_output=True, text=True, timeout=60) + r = _subprocess.run(base_cmd + compose_down_args, + capture_output=True, text=True, timeout=60) if r.returncode != 0: logger.error(f"docker compose down failed: {r.stderr.strip()}") return - result = subprocess.run(base_cmd + compose_up_args, - capture_output=True, text=True, timeout=120) + result = _subprocess.run(base_cmd + compose_up_args, + capture_output=True, text=True, timeout=120) if result.returncode != 0: logger.error(f"docker compose up failed: {result.stderr.strip()}") else: