Commit c075cdc1 authored by Mohammad Ismaeel's avatar Mohammad Ismaeel
Browse files

route get list service bug fixed

parent d53926f3
Loading
Loading
Loading
Loading
+11 −7
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@

import base64, json, logging , os  , requests#, re
from flask import  Blueprint, request , make_response
from common.proto.context_pb2 import ( ServiceId, Service)
from common.proto.context_pb2 import ( ServiceId, Service , Empty ,  ContextId)

from common.tools.descriptor.Tools import get_descriptors_add_services
from google.protobuf.json_format import MessageToDict , ParseDict
@@ -173,13 +173,16 @@ def delete_child_service ():
        logging.info(f"error in deleting child service {e}") 
        return make_response(f'Error !! {e}' ,400) 
    
@service.route('/get_list_service', methods=['GET'])
def get_list_service():
   
@service.route('/get_list_service/<context_uuid>', methods=['GET'])
def get_list_service(context_uuid):
     
    if not context_uuid:
        return make_response("context_uuid is required", 400) 
    context_id= ContextId()
    context_id.context_uuid.uuid = context_uuid
    try:
        context_client.connect()
        list_services = context_client.ListServices()
        list_services = context_client.ListServices(context_id=context_id)
        if not list_services:
            return make_response("No services found", 404)
        services_list = []
@@ -200,12 +203,13 @@ def get_child_services():
   
    port = data.get('port', 8008)
    host = data.get('host', None)
    context_uuid= data.get('context_uuid', 'admin')

    if not host:
        return make_response("host is required", 400)
    

    url = ('http://{}:{}/service/get_list_service').format(host, port)
    url = ('http://{}:{}/service/get_list_service/{}').format(host, port,context_uuid)
    
    try:
        response = requests.get(url)