fix(ci): handle missing 'ip' command in QEMU swarm orchestrator
The IDF container doesn't have iproute2 installed, so 'ip' binary is missing. Add shutil.which() check to can_tap guard and catch FileNotFoundError in _run_ip() for robustness. Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
parent
e0b808d3ac
commit
e94e2c1902
|
|
@ -326,7 +326,12 @@ class NetworkState:
|
||||||
|
|
||||||
|
|
||||||
def _run_ip(args: List[str], check: bool = False) -> subprocess.CompletedProcess:
|
def _run_ip(args: List[str], check: bool = False) -> subprocess.CompletedProcess:
|
||||||
return subprocess.run(["ip"] + args, capture_output=True, text=True, check=check)
|
try:
|
||||||
|
return subprocess.run(["ip"] + args, capture_output=True, text=True, check=check)
|
||||||
|
except FileNotFoundError:
|
||||||
|
# 'ip' command not installed (e.g. minimal container image)
|
||||||
|
return subprocess.CompletedProcess(args=["ip"] + args, returncode=127,
|
||||||
|
stdout="", stderr="ip: command not found")
|
||||||
|
|
||||||
|
|
||||||
def setup_network(cfg: SwarmConfig, net: NetworkState) -> Dict[int, List[str]]:
|
def setup_network(cfg: SwarmConfig, net: NetworkState) -> Dict[int, List[str]]:
|
||||||
|
|
@ -338,8 +343,10 @@ def setup_network(cfg: SwarmConfig, net: NetworkState) -> Dict[int, List[str]]:
|
||||||
node_net_args: Dict[int, List[str]] = {}
|
node_net_args: Dict[int, List[str]] = {}
|
||||||
n = len(cfg.nodes)
|
n = len(cfg.nodes)
|
||||||
|
|
||||||
# Check if we can use TAP/bridge (requires root on Linux)
|
# Check if we can use TAP/bridge (requires root on Linux + ip command)
|
||||||
can_tap = IS_LINUX and hasattr(os, 'geteuid') and os.geteuid() == 0
|
import shutil
|
||||||
|
can_tap = (IS_LINUX and hasattr(os, 'geteuid') and os.geteuid() == 0
|
||||||
|
and shutil.which("ip") is not None)
|
||||||
|
|
||||||
if not can_tap:
|
if not can_tap:
|
||||||
if IS_LINUX:
|
if IS_LINUX:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue