Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/paude/backends/openshift/session_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,10 @@ def _build_exec_cmd(
else:
cmd = ["oc", "exec", "-it", "-n", ns, pname, "--"]

env_args = ["env", "PAUDE_HEADLESS=0"]
if port_urls:
cmd.extend(["env", f"PAUDE_PORT_URLS={';'.join(port_urls)}"])
env_args.append(f"PAUDE_PORT_URLS={';'.join(port_urls)}")
cmd.extend(env_args)

cmd.append("/usr/local/bin/entrypoint-session.sh")
return cmd
Expand Down
7 changes: 6 additions & 1 deletion tests/test_openshift_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -1076,7 +1076,7 @@ def _make_connector(self, context: str | None = None) -> Any:
)

def test_exec_cmd_without_port_urls(self) -> None:
"""Exec command has no env prefix when no port URLs."""
"""Exec command overrides PAUDE_HEADLESS even without port URLs."""
connector = self._make_connector()
cmd = connector._build_exec_cmd("pod-0", "test-ns")
assert cmd == [
Expand All @@ -1087,6 +1087,8 @@ def test_exec_cmd_without_port_urls(self) -> None:
"test-ns",
"pod-0",
"--",
"env",
"PAUDE_HEADLESS=0",
"/usr/local/bin/entrypoint-session.sh",
]

Expand All @@ -1099,6 +1101,7 @@ def test_exec_cmd_with_port_urls(self) -> None:
port_urls=["http://localhost:18789"],
)
assert "env" in cmd
assert "PAUDE_HEADLESS=0" in cmd
assert "PAUDE_PORT_URLS=http://localhost:18789" in cmd
# env and PAUDE_PORT_URLS must come before entrypoint
env_idx = cmd.index("env")
Expand All @@ -1113,6 +1116,7 @@ def test_exec_cmd_with_multiple_port_urls(self) -> None:
"test-ns",
port_urls=["http://localhost:8080", "http://localhost:8443"],
)
assert "PAUDE_HEADLESS=0" in cmd
env_val = [c for c in cmd if c.startswith("PAUDE_PORT_URLS=")][0]
assert env_val == (
"PAUDE_PORT_URLS=http://localhost:8080;http://localhost:8443"
Expand All @@ -1128,6 +1132,7 @@ def test_exec_cmd_with_context_and_port_urls(self) -> None:
)
assert cmd[:4] == ["oc", "--context", "my-ctx", "exec"]
assert "env" in cmd
assert "PAUDE_HEADLESS=0" in cmd
assert "PAUDE_PORT_URLS=http://localhost:18789" in cmd


Expand Down