]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Ensure that correct root helper is used
authorGary Kotton <gkotton@redhat.com>
Fri, 25 Jan 2013 15:30:26 +0000 (15:30 +0000)
committerGary Kotton <gkotton@redhat.com>
Fri, 25 Jan 2013 15:33:35 +0000 (15:33 +0000)
Fixes bug 1105193

Change-Id: Iaaf0b3687c410f5dbfa152d601ae3b2492a610dd

quantum/agent/ovs_cleanup_util.py
quantum/tests/unit/test_agent_ovs_cleanup.py

index cce0ae6d8166b9deead1546ea92746039c3ac33c..a744c16dbbb2f38a0e5d9ca805a7df8ad508c82c 100644 (file)
@@ -41,10 +41,15 @@ def setup_conf():
                            'bridges.'))
     ]
 
+    agent_opts = [
+        cfg.StrOpt('root_helper', default='sudo'),
+    ]
+
     conf = cfg.CommonConfigOpts()
     conf.register_cli_opts(opts)
     conf.register_opts(l3_agent.L3NATAgent.OPTS)
     conf.register_opts(interface.OPTS)
+    conf.register_opts(agent_opts, 'AGENT')
     config.setup_logging(conf)
     return conf
 
@@ -60,7 +65,7 @@ def main():
 
     configuration_bridges = set([conf.ovs_integration_bridge,
                                  conf.external_network_bridge])
-    ovs_bridges = set(ovs_lib.get_bridges(conf.root_helper))
+    ovs_bridges = set(ovs_lib.get_bridges(conf.AGENT.root_helper))
 
     if conf.ovs_all_ports:
         bridges = ovs_bridges
@@ -69,7 +74,7 @@ def main():
 
     for bridge in bridges:
         LOG.info(_("Cleaning %s"), bridge)
-        ovs = ovs_lib.OVSBridge(bridge, conf.root_helper)
+        ovs = ovs_lib.OVSBridge(bridge, conf.AGENT.root_helper)
         ovs.delete_ports(all_ports=conf.ovs_all_ports)
 
     LOG.info(_("OVS cleanup completed successfully"))
index d82f4103d0c71439a275d5bfe73d2f5c2bc1a27d..6464857224f24e0ed420136228502df5cc0f4bbc 100644 (file)
@@ -28,6 +28,7 @@ class TestOVSCleanup(unittest.TestCase):
             self.assertEqual(conf.external_network_bridge, 'br-ex')
             self.assertEqual(conf.ovs_integration_bridge, 'br-int')
             self.assertFalse(conf.ovs_all_ports)
+            self.assertEqual(conf.AGENT.root_helper, 'sudo')
 
     def test_main(self):
         with mock.patch('quantum.common.config.setup_logging'):