Changes in vimconn_vmware.py : Addressed code review comments for implementation... 02/1002/1
authorkate <akate@vmware.com>
Tue, 24 Jan 2017 11:20:43 +0000 (03:20 -0800)
committerkate <akate@vmware.com>
Tue, 24 Jan 2017 11:21:04 +0000 (03:21 -0800)
Change-Id: I783c6455ea75a138eaa825e248bc12208a5b6380
Signed-off-by: kate <akate@vmware.com>
vimconn_vmware.py

index bd427a9..45b27fb 100644 (file)
@@ -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