]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Bug 1015953 - linuxbridge_quantum_agent device_exists() is buggy
authorncode <juliano.martinez@locaweb.com.br>
Thu, 21 Jun 2012 10:27:52 +0000 (07:27 -0300)
committerncode <juliano.martinez@locaweb.com.br>
Thu, 21 Jun 2012 13:14:45 +0000 (10:14 -0300)
Just added the check_exit_code=False to utils.execute call

Change-Id: I3105131e853d45609bc441482bf5b3c3e035a129

quantum/plugins/linuxbridge/agent/linuxbridge_quantum_agent.py

index 064c23dae48075ae0d89dfd11d519e44e40231f1..4eb2620286b37a5c4b60050dc8c182475a8339bd 100755 (executable)
@@ -66,12 +66,12 @@ class LinuxBridge:
 
     def device_exists(self, device):
         """Check if ethernet device exists."""
-        retval = utils.execute(['ip', 'link', 'show',
-                                'dev', device], root_helper=self.root_helper)
-        if retval:
-            return True
-        else:
+        try:
+            utils.execute(['ip', 'link', 'show', 'dev', device],
+                          root_helper=self.root_helper)
+        except RuntimeError:
             return False
+        return True
 
     def get_bridge_name(self, network_id):
         if not network_id: