fix: subprocess not imported in _do_apply background thread
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 <noreply@anthropic.com>
This commit is contained in:
+5
-4
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user