]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
ML2: Simplified boolean variable check
authorRavi Shekhar Jethani <ravishekar.jethani@nttdata.com>
Thu, 19 Nov 2015 10:02:31 +0000 (02:02 -0800)
committerRavi Shekhar Jethani <ravishekar.jethani@nttdata.com>
Mon, 11 Jan 2016 13:24:23 +0000 (13:24 +0000)
Currently 'flows' is being checked for empty list in
a non standard way 'if flows == []:'. This patch
simplifies logic so that above check is unnecessary.

TrivialFix

Change-Id: I0eac42e425213b6588090e7e2379b14446308361

neutron/plugins/ml2/drivers/openvswitch/agent/openflow/native/br_int.py

index 2c4bd47f11dc0eeaf9441bfb8a402ae8343def07..e7bfb0dcf97991efcc8e808709c4aed3ade3a11c 100644 (file)
@@ -51,9 +51,7 @@ class OVSIntegrationBridge(ovs_bridge.OVSAgentBridge):
         except RuntimeError:
             LOG.exception(_LE("Failed to communicate with the switch"))
             return constants.OVS_DEAD
-        if flows == []:
-            return constants.OVS_RESTARTED
-        return constants.OVS_NORMAL
+        return constants.OVS_NORMAL if flows else constants.OVS_RESTARTED
 
     @staticmethod
     def _local_vlan_match(_ofp, ofpp, port, vlan_vid):