Skip to content
This repository was archived by the owner on Jan 23, 2026. It is now read-only.

Commit aca7e3d

Browse files
committed
Pass use_alternative_endpoints to shell
1 parent 7896edb commit aca7e3d

4 files changed

Lines changed: 32 additions & 6 deletions

File tree

packages/jumpstarter-cli-client/jumpstarter_cli_client/client_shell.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ def client_shell(config, selector: str, duration: timedelta, lease_name):
2222
with config.lease(selector=selector, lease_name=lease_name, duration=duration) as lease:
2323
with lease.serve_unix() as path:
2424
with lease.monitor():
25-
exit_code = launch_shell(path, "remote", config.drivers.allow, config.drivers.unsafe)
25+
exit_code = launch_shell(
26+
path, "remote", config.drivers.allow, config.drivers.unsafe, config.useAlternativeEndpoints
27+
)
2628

2729
sys.exit(exit_code)

packages/jumpstarter/jumpstarter/client/client.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,18 @@
1313

1414

1515
@asynccontextmanager
16-
async def client_from_path(path: str, portal: BlockingPortal, stack: ExitStack, allow: list[str], unsafe: bool):
16+
async def client_from_path(
17+
path: str,
18+
portal: BlockingPortal,
19+
stack: ExitStack,
20+
allow: list[str],
21+
unsafe: bool,
22+
use_alternative_endpoints: bool = False,
23+
):
1724
async with grpc.aio.secure_channel(
1825
f"unix://{path}", grpc.local_channel_credentials(grpc.LocalConnectionType.UDS)
1926
) as channel:
20-
yield await client_from_channel(channel, portal, stack, allow, unsafe)
27+
yield await client_from_channel(channel, portal, stack, allow, unsafe, use_alternative_endpoints)
2128

2229

2330
async def client_from_channel(

packages/jumpstarter/jumpstarter/common/utils.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from jumpstarter.client import client_from_path
99
from jumpstarter.config.client import _allow_from_env
10-
from jumpstarter.config.env import JMP_DRIVERS_ALLOW, JUMPSTARTER_HOST
10+
from jumpstarter.config.env import JMP_DRIVERS_ALLOW, JMP_USE_ALTERNATIVE_ENDPOINTS, JUMPSTARTER_HOST
1111
from jumpstarter.driver import Driver
1212
from jumpstarter.exporter import Session
1313

@@ -52,7 +52,16 @@ async def env_async(portal, stack):
5252

5353
allow, unsafe = _allow_from_env()
5454

55-
async with client_from_path(host, portal, stack, allow=allow, unsafe=unsafe) as client:
55+
use_alternative_endpoints = os.environ.get(JMP_USE_ALTERNATIVE_ENDPOINTS, "0") == "1"
56+
57+
async with client_from_path(
58+
host,
59+
portal,
60+
stack,
61+
allow=allow,
62+
unsafe=unsafe,
63+
use_alternative_endpoints=use_alternative_endpoints,
64+
) as client:
5665
try:
5766
yield client
5867
finally:
@@ -80,7 +89,13 @@ def env():
8089
PROMPT_CWD = "\\W"
8190

8291

83-
def launch_shell(host: str, context: str, allow: list[str], unsafe: bool) -> int:
92+
def launch_shell(
93+
host: str,
94+
context: str,
95+
allow: list[str],
96+
unsafe: bool,
97+
use_alternative_endpoints: bool,
98+
) -> int:
8499
"""Launch a shell with a custom prompt indicating the exporter type.
85100
86101
Args:
@@ -98,6 +113,7 @@ def launch_shell(host: str, context: str, allow: list[str], unsafe: bool) -> int
98113
| {
99114
JUMPSTARTER_HOST: host,
100115
JMP_DRIVERS_ALLOW: "UNSAFE" if unsafe else ",".join(allow),
116+
JMP_USE_ALTERNATIVE_ENDPOINTS: "1" if use_alternative_endpoints else "0",
101117
"PS1": f"{ANSI_GRAY}{PROMPT_CWD} {ANSI_YELLOW}{ANSI_WHITE}{context} {ANSI_YELLOW}{ANSI_RESET} ",
102118
},
103119
)

packages/jumpstarter/jumpstarter/config/env.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
JMP_DRIVERS_ALLOW = "JMP_DRIVERS_ALLOW"
88
JUMPSTARTER_HOST = "JUMPSTARTER_HOST"
99
JMP_LEASE = "JMP_LEASE"
10+
JMP_USE_ALTERNATIVE_ENDPOINTS = "JMP_USE_ALTERNATIVE_ENDPOINTS"

0 commit comments

Comments
 (0)