From 89602824597db2dcf7c90fbfa46723df46f9c64a Mon Sep 17 00:00:00 2001 From: Gary Kotton <gkotton@vmware.com> Date: Sun, 21 Jan 2018 01:53:27 -0800 Subject: [PATCH] TVD: make security group logging more robust Ensure that DVS security groups (which do not have this extension) do not cause exceptions Change-Id: I1a318347f92d6d793768dd20d653c872a3f75da3 --- vmware_nsx/plugins/nsx_v/plugin.py | 2 +- vmware_nsx/plugins/nsx_v3/plugin.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vmware_nsx/plugins/nsx_v/plugin.py b/vmware_nsx/plugins/nsx_v/plugin.py index 5d77898694..b205a4d58c 100644 --- a/vmware_nsx/plugins/nsx_v/plugin.py +++ b/vmware_nsx/plugins/nsx_v/plugin.py @@ -561,7 +561,7 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin, # If the section/sg is already logged, then no action is # required. for sg in [sg for sg in self.get_security_groups(context) - if sg[sg_logging.LOGGING] is False]: + if sg.get(sg_logging.LOGGING) is False]: if sg.get(sg_policy.POLICY): # Logging is not relevant with a policy continue diff --git a/vmware_nsx/plugins/nsx_v3/plugin.py b/vmware_nsx/plugins/nsx_v3/plugin.py index d4f08d3de6..5a0dcd3aeb 100644 --- a/vmware_nsx/plugins/nsx_v3/plugin.py +++ b/vmware_nsx/plugins/nsx_v3/plugin.py @@ -667,7 +667,7 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin, fields=['id', sg_logging.LOGGING]) for sg in [sg for sg in secgroups - if sg[sg_logging.LOGGING] is False]: + if sg.get(sg_logging.LOGGING) is False]: nsgroup_id, section_id = nsx_db.get_sg_mappings( context.session, sg['id']) if section_id: