Exemple #1
0
    def GetXproto(self, request, context):
        res = utility_pb2.XProtos()

        core_dir = os.path.abspath(
            os.path.dirname(os.path.realpath(__file__)) + "/../core/models/")
        core_xprotos = get_xproto(core_dir)

        service_dir = os.path.abspath(
            os.path.dirname(os.path.realpath(__file__)) + "/../services")
        services_xprotos = get_xproto(service_dir)

        dynamic_service_dir = os.path.abspath(
            os.path.dirname(os.path.realpath(__file__)) +
            "/../dynamic_services")
        dynamic_services_xprotos = get_xproto(dynamic_service_dir)

        xprotos = core_xprotos + services_xprotos + dynamic_services_xprotos

        xproto = ""

        for f in xprotos:
            content = open(f).read()
            xproto += "\n"
            xproto += content

        res.xproto = xproto
        REQUEST_COUNT.labels("xos-core", "Utilities", "GetXproto",
                             grpc.StatusCode.OK).inc()
        return res
Exemple #2
0
    def GetXproto(self, request, context):
        res = utility_pb2.XProtos()

        core_dir = os.path.abspath(
            os.path.dirname(os.path.realpath(__file__)) + '/../core/models/')
        core_xprotos = get_xproto(core_dir)

        service_dir = os.path.abspath(
            os.path.dirname(os.path.realpath(__file__)) + '/../services')
        services_xprotos = get_xproto(service_dir)

        dynamic_service_dir = os.path.abspath(
            os.path.dirname(os.path.realpath(__file__)) +
            '/../dynamic_services')
        dynamic_services_xprotos = get_xproto(dynamic_service_dir)

        xprotos = core_xprotos + services_xprotos + dynamic_services_xprotos

        xproto = ""

        for f in xprotos:
            content = open(f).read()
            xproto += "\n"
            xproto += content

        res.xproto = xproto
        return res