From d4d1179c381e7367f41b09091e79578c7062c530 Mon Sep 17 00:00:00 2001 From: Abdelilah Essiari Date: Tue, 12 Nov 2024 10:09:51 -0800 Subject: [PATCH] using name when retrieving sense instance details --- fabfed/provider/sense/sense_network.py | 2 +- fabfed/provider/sense/sense_node.py | 2 +- fabfed/provider/sense/sense_utils.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fabfed/provider/sense/sense_network.py b/fabfed/provider/sense/sense_network.py index 2b775656..4408bb12 100644 --- a/fabfed/provider/sense/sense_network.py +++ b/fabfed/provider/sense/sense_network.py @@ -46,7 +46,7 @@ def create(self): raise Exception(f"Creation failed for {si_uuid} {status}") logger.debug(f"Retrieving details {self.name} {status}") - instance_dict = sense_utils.service_instance_details(si_uuid=si_uuid) + instance_dict = sense_utils.service_instance_details(si_uuid=si_uuid, alias=self.name) import json diff --git a/fabfed/provider/sense/sense_node.py b/fabfed/provider/sense/sense_node.py index 91a3e071..e980e447 100644 --- a/fabfed/provider/sense/sense_node.py +++ b/fabfed/provider/sense/sense_node.py @@ -32,7 +32,7 @@ def create(self): raise SenseException(f"Instance is not ready:status={status}") """ retrieve the gateway type from intents """ - instance_dict = sense_utils.service_instance_details(si_uuid=si_uuid) + instance_dict = sense_utils.service_instance_details(si_uuid=si_uuid, alias=self.network) gateway_type = instance_dict.get("intents")[0]['json']['data']['gateways'][0]['type'].upper() if "GCP" in gateway_type: template_file = 'gcp-template.json' diff --git a/fabfed/provider/sense/sense_utils.py b/fabfed/provider/sense/sense_utils.py index 1433663f..d8bcb74e 100644 --- a/fabfed/provider/sense/sense_utils.py +++ b/fabfed/provider/sense/sense_utils.py @@ -280,10 +280,10 @@ def instance_get_status(*, client=None, si_uuid): return workflow_api.instance_get_status(si_uuid=si_uuid) -def service_instance_details(*, client=None, si_uuid): +def service_instance_details(*, client=None, si_uuid, alias): client = client or get_client() discover_api = DiscoverApi(req_wrapper=client) - response = discover_api.discover_service_instances_get() + response = discover_api.discover_service_instances_get(search=alias) # print(json.dumps(json.loads(response), indent=2)) response = json.loads(response) instances = response['instances']