From 08f1c6107db58174c10ee79797f09990f481d488 Mon Sep 17 00:00:00 2001 From: Devang Doshi Date: Fri, 21 Jul 2017 11:51:08 -0700 Subject: [PATCH] Tempest: Fixed a bug # 1914831 - Add results into list only if it is present. Tested and verified on local testbed. Change-Id: I93c3d9921fdc5f096b1d1d6bdc6ba77a19f67117 --- vmware_nsx_tempest/services/nsxv3_client.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/vmware_nsx_tempest/services/nsxv3_client.py b/vmware_nsx_tempest/services/nsxv3_client.py index 451d33e..0eea523 100644 --- a/vmware_nsx_tempest/services/nsxv3_client.py +++ b/vmware_nsx_tempest/services/nsxv3_client.py @@ -172,14 +172,17 @@ class NSXV3Client(object): for the cursor. If cursor is present, query url for multiple pages to get all the logical resources. """ + results = [] response = self.get(endpoint=endpoint) res_json = response.json() cursor = res_json.get("cursor") + if res_json.get("results"): + results.extend(res_json["results"]) while cursor: page = self.get(endpoint=endpoint, cursor=cursor).json() - res_json["results"].extend(page.get("results", [])) + results.extend(page.get("results", [])) cursor = page.get("cursor") - return res_json["results"] + return results def get_transport_zones(self): """