Exemplo n.º 1
0
 def GetNodeService(self, request, context):
     logging.debug("get node service: %s", request)
     session = self.get_session(request.session_id, context)
     service = session.services.get_service(request.node_id,
                                            request.service,
                                            default_service=True)
     service_proto = core_pb2.NodeServiceData(
         executables=service.executables,
         dependencies=service.dependencies,
         dirs=service.dirs,
         configs=service.configs,
         startup=service.startup,
         validate=service.validate,
         validation_mode=service.validation_mode.value,
         validation_timer=service.validation_timer,
         shutdown=service.shutdown,
         meta=service.meta)
     return core_pb2.GetNodeServiceResponse(service=service_proto)
Exemplo n.º 2
0
def get_service_configuration(service: Type[CoreService]) -> core_pb2.NodeServiceData:
    """
    Convenience for converting a service to service data proto.

    :param service: service to get proto data for
    :return: service proto data
    """
    return core_pb2.NodeServiceData(
        executables=service.executables,
        dependencies=service.dependencies,
        dirs=service.dirs,
        configs=service.configs,
        startup=service.startup,
        validate=service.validate,
        validation_mode=service.validation_mode.value,
        validation_timer=service.validation_timer,
        shutdown=service.shutdown,
        meta=service.meta,
    )