From 902ac80ebf10b5b620ba6d14f2a9ca33749eeb9f Mon Sep 17 00:00:00 2001 From: asarfaty Date: Tue, 14 Jul 2020 17:18:50 +0200 Subject: [PATCH] Fix get_firewall_section_id to return a valid section Change-Id: I1fac23589092e0bddd97b1ffa05c9f6fbb21d798 --- vmware_nsxlib/v3/core_resources.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vmware_nsxlib/v3/core_resources.py b/vmware_nsxlib/v3/core_resources.py index 71fdc75e..6a3cbe63 100644 --- a/vmware_nsxlib/v3/core_resources.py +++ b/vmware_nsxlib/v3/core_resources.py @@ -831,6 +831,7 @@ class NsxLibLogicalRouter(utils.NsxLibApiBase): If the router was already retrieved from the backend it is possible to give it as an input to avoid another backend call. + In case of multiple sections, the first valid one will be returned """ if not router_body: router_body = self.get(lrouter_id) @@ -839,7 +840,7 @@ class NsxLibLogicalRouter(utils.NsxLibApiBase): for sec in firewall_sections: if (sec.get('is_valid') and sec.get('target_type') == "FirewallSection"): - return firewall_sections[0].get('target_id') + return sec.get('target_id') def list(self, router_type=None): """List all/by type logical routers."""