Procházet zdrojové kódy

Fix nsenter PATH: nmcli not found in minimal PID 1 environment

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
tuanchris před 4 měsíci
rodič
revize
c2d018d432
1 změnil soubory, kde provedl 4 přidání a 1 odebrání
  1. 4 1
      modules/wifi/manager.py

+ 4 - 1
modules/wifi/manager.py

@@ -28,7 +28,10 @@ def run_host_command(*args: str, timeout: int = 30) -> subprocess.CompletedProce
     In venv: executes directly.
     """
     if is_docker():
-        cmd = ["nsenter", "-t", "1", "-m", "-u", "-i", "-n", "-p", "--"] + list(args)
+        # Use env to set PATH because nsenter into PID 1 has a minimal PATH
+        # that may not include /usr/bin where nmcli lives
+        cmd = ["nsenter", "-t", "1", "-m", "-u", "-i", "-n", "-p", "--",
+               "env", "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"] + list(args)
     else:
         cmd = list(args)