From 3471868dc9e2c5edb0cbe40b81f18692e10e0ec9 Mon Sep 17 00:00:00 2001 From: kate Date: Tue, 24 Jan 2017 03:20:43 -0800 Subject: [PATCH] Changes in vimconn_vmware.py : Addressed code review comments for implementation of get_image_list specification Change-Id: I783c6455ea75a138eaa825e248bc12208a5b6380 Signed-off-by: kate --- vimconn_vmware.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/vimconn_vmware.py b/vimconn_vmware.py index bd427a98..45b27fb0 100644 --- a/vimconn_vmware.py +++ b/vimconn_vmware.py @@ -1096,17 +1096,18 @@ class vimconnector(vimconn.vimconnector): catalog_uuid = catalog.get_id().split(":")[3] name = catalog.name filtered_dict = {} - - if ("name" not in filter_dict and "id" not in filter_dict) or \ - (filter_dict.get('id') == catalog_uuid or filter_dict.get('name') == name): - filtered_dict ["name"] = name - filtered_dict ["id"] = catalog_uuid - image_list.append(filtered_dict) + if filter_dict.get("name") and filter_dict["name"] != name: + continue + if filter_dict.get("id") and filter_dict["id"] != catalog_uuid: + continue + filtered_dict ["name"] = name + filtered_dict ["id"] = catalog_uuid + image_list.append(filtered_dict) self.logger.debug("List of already created catalog items: {}".format(image_list)) return image_list except Exception as exp: - self.logger.error("Exception occured while retriving catalog items {}".format(exp)) + vimconn.vimconnException("Exception occured while retriving catalog items {}".format(exp)) def get_vappid(self, vdc=None, vapp_name=None): """ Method takes vdc object and vApp name and returns vapp uuid or None -- 2.25.1