Merge "Only setup dhcp interface if dhcp is not active on network"

This commit is contained in:
Jenkins 2014-09-21 00:21:03 +00:00 committed by Gerrit Code Review
commit ab483542b3
2 changed files with 2 additions and 1 deletions

View File

@ -198,10 +198,10 @@ class DhcpLocalProcess(DhcpBase):
def enable(self):
"""Enables DHCP for this network by spawning a local process."""
interface_name = self.device_manager.setup(self.network)
if self.active:
self.restart()
elif self._enable_dhcp():
interface_name = self.device_manager.setup(self.network)
self.interface_name = interface_name
self.spawn_process()

View File

@ -583,6 +583,7 @@ class TestDhcpLocalProcess(TestBase):
lp.enable()
self.assertEqual(lp.called, ['restart'])
self.assertFalse(self.mock_mgr.return_value.setup.called)
def test_enable(self):
attrs_to_mock = dict(