From a2e57b7b51aeda58a503e4edcf3aa389dd99e202 Mon Sep 17 00:00:00 2001 From: Rahul Shetty <160733420+rh-rahulshetty@users.noreply.github.com> Date: Fri, 10 Jul 2026 17:45:08 +0530 Subject: [PATCH] fix: pass ip commands as single strings to avoid bash -c argument splitting (#1459) exec_cmd_in_pod wraps commands with `bash -c` when no base_command is specified. Passing ["ip", "-br", "addr", "show"] produces ["bash", "-c", "ip", "-br", "addr", "show"]. Due to bash -c semantics, only the first argument after -c ("ip") is treated as the command string; the rest become unused positional parameters. This caused bare `ip` to run with no arguments, printing help/usage text instead of interface data. The egress scenario was unaffected because it uses base_command="chroot" which constructs commands correctly without bash -c wrapping. Pass each command as a single string (e.g. ["ip -br addr show"]) so bash -c treats it as one complete command. Closes #1380 Signed-off-by: Rahul Shetty Co-authored-by: Claude Opus 4.6 --- krkn/scenario_plugins/native/network/ingress_shaping.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/krkn/scenario_plugins/native/network/ingress_shaping.py b/krkn/scenario_plugins/native/network/ingress_shaping.py index 4d426936..5f07920d 100644 --- a/krkn/scenario_plugins/native/network/ingress_shaping.py +++ b/krkn/scenario_plugins/native/network/ingress_shaping.py @@ -185,7 +185,7 @@ def get_default_interface(node: str, pod_template, kubecli: KrknKubernetes, imag kubecli.create_pod(pod_body, "default", 300) pod_name = f"fedtools-{pod_name_regex}" try: - cmd = ["ip", "r"] + cmd = ["ip r"] output = kubecli.exec_cmd_in_pod(cmd, pod_name, "default") if not output: @@ -238,7 +238,7 @@ def verify_interface( pod_name = f"fedtools-{pod_name_regex}" try: if input_interface_list == []: - cmd = ["ip", "r"] + cmd = ["ip r"] output = kubecli.exec_cmd_in_pod(cmd, pod_name, "default") if not output: @@ -254,7 +254,7 @@ def verify_interface( input_interface_list = [default_route.split()[4]] else: - cmd = ["ip", "-br", "addr", "show"] + cmd = ["ip -br addr show"] output = kubecli.exec_cmd_in_pod(cmd, pod_name, "default") if not output: