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

Commit 2665c8a

Browse files
committed
Pass use_alternative_endpoints to shell
1 parent 7cc466b commit 2665c8a

4 files changed

Lines changed: 36 additions & 6 deletions

File tree

packages/jumpstarter-cli/jumpstarter_cli/shell.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,13 @@ def shell(config, lease_name, selector, duration):
3131
with config.lease(selector=selector, lease_name=lease_name, duration=duration) as lease:
3232
with lease.serve_unix() as path:
3333
with lease.monitor():
34-
exit_code = launch_shell(path, "remote", config.drivers.allow, config.drivers.unsafe)
34+
exit_code = launch_shell(
35+
path,
36+
"remote",
37+
config.drivers.allow,
38+
config.drivers.unsafe,
39+
use_alternative_endpoints=config.use_alternative_endpoints,
40+
)
3541

3642
sys.exit(exit_code)
3743

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:
@@ -103,6 +118,7 @@ def launch_shell(host: str, context: str, allow: list[str], unsafe: bool) -> int
103118
| {
104119
JUMPSTARTER_HOST: host,
105120
JMP_DRIVERS_ALLOW: "UNSAFE" if unsafe else ",".join(allow),
121+
JMP_USE_ALTERNATIVE_ENDPOINTS: "1" if use_alternative_endpoints else "0",
106122
"PS1": f"{ANSI_GRAY}{PROMPT_CWD} {ANSI_YELLOW}{ANSI_WHITE}{context} {ANSI_YELLOW}{ANSI_RESET} ",
107123
},
108124
)

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)