From 805be3f8090ee625eb5f094183e68a4e8c4482c8 Mon Sep 17 00:00:00 2001 From: Blake Harnden <32446120+bharnden@users.noreply.github.com> Date: Tue, 4 May 2021 15:42:32 -0700 Subject: [PATCH] grpc: removed get node config services, achieved with get node or get session --- daemon/core/api/grpc/client.py | 14 -------------- daemon/core/api/grpc/server.py | 17 ----------------- daemon/proto/core/api/grpc/configservices.proto | 9 --------- daemon/proto/core/api/grpc/core.proto | 2 -- 4 files changed, 42 deletions(-) diff --git a/daemon/core/api/grpc/client.py b/daemon/core/api/grpc/client.py index b0a3ec11..c258c91e 100644 --- a/daemon/core/api/grpc/client.py +++ b/daemon/core/api/grpc/client.py @@ -25,7 +25,6 @@ from core.api.grpc.configservices_pb2 import ( GetConfigServiceDefaultsRequest, GetConfigServicesRequest, GetNodeConfigServiceRequest, - GetNodeConfigServicesRequest, SetNodeConfigServiceRequest, ) from core.api.grpc.core_pb2 import ExecuteScriptRequest @@ -1131,19 +1130,6 @@ class CoreGrpcClient: response = self.stub.GetNodeConfigService(request) return dict(response.config) - def get_node_config_services(self, session_id: int, node_id: int) -> List[str]: - """ - Retrieves the config services currently assigned to a node. - - :param session_id: session node belongs to - :param node_id: id of node to get config services for - :return: list of config services - :raises grpc.RpcError: when session or node doesn't exist - """ - request = GetNodeConfigServicesRequest(session_id=session_id, node_id=node_id) - response = self.stub.GetNodeConfigServices(request) - return list(response.services) - def set_node_config_service( self, session_id: int, node_id: int, name: str, config: Dict[str, str] ) -> bool: diff --git a/daemon/core/api/grpc/server.py b/daemon/core/api/grpc/server.py index 8fee64ef..534c1578 100644 --- a/daemon/core/api/grpc/server.py +++ b/daemon/core/api/grpc/server.py @@ -28,8 +28,6 @@ from core.api.grpc.configservices_pb2 import ( GetConfigServicesResponse, GetNodeConfigServiceRequest, GetNodeConfigServiceResponse, - GetNodeConfigServicesRequest, - GetNodeConfigServicesResponse, SetNodeConfigServiceRequest, SetNodeConfigServiceResponse, ) @@ -1404,21 +1402,6 @@ class CoreGrpcServer(core_pb2_grpc.CoreApiServicer): templates=templates, config=config, modes=modes ) - def GetNodeConfigServices( - self, request: GetNodeConfigServicesRequest, context: ServicerContext - ) -> GetNodeConfigServicesResponse: - """ - Get configuration services for a given node. - - :param request: get node config services request - :param context: grpc context - :return: get node config services response - """ - session = self.get_session(request.session_id, context) - node = self.get_node(session, request.node_id, context, CoreNode) - services = node.config_services.keys() - return GetNodeConfigServicesResponse(services=services) - def SetNodeConfigService( self, request: SetNodeConfigServiceRequest, context: ServicerContext ) -> SetNodeConfigServiceResponse: diff --git a/daemon/proto/core/api/grpc/configservices.proto b/daemon/proto/core/api/grpc/configservices.proto index e8d93fb0..7a71ab8c 100644 --- a/daemon/proto/core/api/grpc/configservices.proto +++ b/daemon/proto/core/api/grpc/configservices.proto @@ -67,15 +67,6 @@ message GetNodeConfigServiceResponse { map config = 1; } -message GetNodeConfigServicesRequest { - int32 session_id = 1; - int32 node_id = 2; -} - -message GetNodeConfigServicesResponse { - repeated string services = 1; -} - message SetNodeConfigServiceRequest { int32 session_id = 1; int32 node_id = 2; diff --git a/daemon/proto/core/api/grpc/core.proto b/daemon/proto/core/api/grpc/core.proto index b03a101c..0466a449 100644 --- a/daemon/proto/core/api/grpc/core.proto +++ b/daemon/proto/core/api/grpc/core.proto @@ -87,8 +87,6 @@ service CoreApi { } rpc GetNodeConfigService (configservices.GetNodeConfigServiceRequest) returns (configservices.GetNodeConfigServiceResponse) { } - rpc GetNodeConfigServices (configservices.GetNodeConfigServicesRequest) returns (configservices.GetNodeConfigServicesResponse) { - } rpc SetNodeConfigService (configservices.SetNodeConfigServiceRequest) returns (configservices.SetNodeConfigServiceResponse) { }