From a39ab95c1f710ce908c378558601d68b2bb13b49 Mon Sep 17 00:00:00 2001 From: Dmitriy Smirnov Date: Wed, 29 May 2024 14:55:47 +0300 Subject: [PATCH] Fix access to API response image list in DecortController.virt_image_find method --- module_utils/decort_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module_utils/decort_utils.py b/module_utils/decort_utils.py index 7eb3bd1..851d6a1 100644 --- a/module_utils/decort_utils.py +++ b/module_utils/decort_utils.py @@ -1439,7 +1439,7 @@ class DecortController(object): api_resp = self.decort_api_call(requests.post, "/restmachine/cloudapi/image/list", api_params) # On success the above call will return here. On error it will abort execution by calling fail_json. images_list = json.loads(api_resp.content.decode('utf8')) - for image_record in images_list: + for image_record in images_list['data']: if image_record['name'] == virt_name and image_record['status'] == "CREATED" and image_record['type'] == "virtual": if sepid == 0 and pool == "": # if no filtering by SEP ID or pool name is requested, return the first match