From 0f3a13ff58f4eb87fc9c0009fba0841a8054cd35 Mon Sep 17 00:00:00 2001 From: Pierre Lasorak Date: Wed, 29 May 2024 14:26:05 +0200 Subject: [PATCH] extent describe --- src/drunc/controller/controller.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/drunc/controller/controller.py b/src/drunc/controller/controller.py index 6b489cf..f12cc6d 100644 --- a/src/drunc/controller/controller.py +++ b/src/drunc/controller/controller.py @@ -120,6 +120,7 @@ def __init__(self, configuration, name:str, session:str, token:Token, applicatio self.application_registry = None self.application_registry_thread = None + self.uri = '' if application_registry_endpoint: from drunc.application_registry.client import ApplicationRegistryClient @@ -260,7 +261,7 @@ def construct_error_node_response(self, command_name:str, token:Token) -> Respon ) def advertise_control_address(self, address, raise_on_missing_registry=False): - my_address = f'grpc://{address}' + self.uri = f'grpc://{address}' if not self.application_registry: from drunc.application_registry.client import ApplicationRegistryNotPresent @@ -270,7 +271,7 @@ def advertise_control_address(self, address, raise_on_missing_registry=False): self.logger.info(f'Registering myself to the application registry') self.application_registry.register( name = self.name, - address = my_address + address = self.uri ) from threading import Thread self.running = True @@ -517,20 +518,31 @@ def describe(self) -> Response: from drunc.utils.grpc_utils import pack_to_any bd = self.describe_broadcast() d = Description( + endpoint = self.uri, type = 'controller', name = self.name, session = self.session, commands = self.commands, + children_endpoints = [child.get_endpoint() for child in self.children_nodes], ) + if bd: d.broadcast.CopyFrom(pack_to_any(bd)) + + response_children = self.propagate_to_list( + 'describe', + command_data = None, + token = token, + node_to_execute = self.children_nodes + ) + return Response ( name = self.name, token = None, data = pack_to_any(d), flag = ResponseFlag.EXECUTED_SUCCESSFULLY, - children = [], + children = response_children, ) # ORDER MATTERS!