This repository was archived by the owner on Jan 23, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
packages/jumpstarter/jumpstarter/client Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010
1111from jumpstarter .client import DriverClient
1212from jumpstarter .common .importlib import import_class
13+ from jumpstarter .common .grpc import aio_secure_channel
1314
1415
1516@asynccontextmanager
@@ -26,6 +27,7 @@ async def client_from_channel(
2627 stack : ExitStack ,
2728 allow : list [str ],
2829 unsafe : bool ,
30+ use_alternative_endpoints : bool = True ,
2931) -> DriverClient :
3032 topo = defaultdict (list )
3133 last_seen = {}
@@ -34,6 +36,25 @@ async def client_from_channel(
3436
3537 response = await jumpstarter_pb2_grpc .ExporterServiceStub (channel ).GetReport (empty_pb2 .Empty ())
3638
39+ if use_alternative_endpoints :
40+ for endpoint in response .alternative_endpoints :
41+ if endpoint .certificate :
42+ attempted_channel = aio_secure_channel (
43+ endpoint .endpoint ,
44+ grpc .ssl_channel_credentials (root_certificates = endpoint .certificate .encode ()),
45+ ) # TODO: set token
46+ try :
47+ response = await jumpstarter_pb2_grpc .ExporterServiceStub (attempted_channel ).GetReport (
48+ empty_pb2 .Empty ()
49+ )
50+ except Exception :
51+ pass # TODO: log failed attempt
52+ else :
53+ channel = attempted_channel
54+ break
55+ else :
56+ continue
57+
3758 for index , report in enumerate (response .reports ):
3859 topo [index ] = []
3960
You can’t perform that action at this time.
0 commit comments