@@ -238,12 +238,19 @@ def factory(
238238
239239 return factory
240240
241- async def _register_with_controller (self , channel : grpc .aio .Channel ):
242- """Register the exporter with the controller."""
243- exporter_stub = jumpstarter_pb2_grpc .ExporterServiceStub (channel )
241+ async def _register_with_controller (self , local_channel : grpc .aio .Channel ):
242+ """Register the exporter with the controller.
243+
244+ Args:
245+ local_channel: The local Unix socket channel to get device reports from
246+ """
247+ # Get device reports from the local session
248+ exporter_stub = jumpstarter_pb2_grpc .ExporterServiceStub (local_channel )
244249 response : jumpstarter_pb2 .GetReportResponse = await exporter_stub .GetReport (empty_pb2 .Empty ())
250+
251+ # Register with the REMOTE controller (not the local session)
245252 logger .info ("Registering exporter with controller" )
246- controller = jumpstarter_pb2_grpc . ControllerServiceStub ( channel )
253+ controller = await self . _get_controller_stub ( )
247254 await controller .Register (
248255 jumpstarter_pb2 .RegisterRequest (
249256 labels = self .labels ,
@@ -253,7 +260,6 @@ async def _register_with_controller(self, channel: grpc.aio.Channel):
253260 # Mark exporter as registered internally
254261 self ._registered = True
255262 # Report that exporter is available to the controller
256- # TODO: Determine if the controller should handle this logic internally
257263 await self ._report_status (ExporterStatus .AVAILABLE , "Exporter registered and available" )
258264
259265 async def _report_status (self , status : ExporterStatus , message : str = "" ):
0 commit comments