Merge "dhcp: rename get_process_uuid as private"
This commit is contained in:
commit
b85b19e384
@ -296,7 +296,7 @@ class DhcpLocalProcess(DhcpBase, metaclass=abc.ABCMeta):
|
|||||||
"""Returns the file name for a given kind of config file."""
|
"""Returns the file name for a given kind of config file."""
|
||||||
return os.path.join(self.network_conf_dir, kind)
|
return os.path.join(self.network_conf_dir, kind)
|
||||||
|
|
||||||
def get_process_uuid(self):
|
def _get_process_uuid(self):
|
||||||
if self.segment:
|
if self.segment:
|
||||||
# NOTE(sahid): Keep the order to match directory path. This is used
|
# NOTE(sahid): Keep the order to match directory path. This is used
|
||||||
# by external_process.ProcessManager to check whether the process
|
# by external_process.ProcessManager to check whether the process
|
||||||
@ -349,7 +349,7 @@ class DhcpLocalProcess(DhcpBase, metaclass=abc.ABCMeta):
|
|||||||
def _get_process_manager(self, cmd_callback=None):
|
def _get_process_manager(self, cmd_callback=None):
|
||||||
return external_process.ProcessManager(
|
return external_process.ProcessManager(
|
||||||
conf=self.conf,
|
conf=self.conf,
|
||||||
uuid=self.get_process_uuid(),
|
uuid=self._get_process_uuid(),
|
||||||
namespace=self.network.namespace,
|
namespace=self.network.namespace,
|
||||||
service=DNSMASQ_SERVICE_NAME,
|
service=DNSMASQ_SERVICE_NAME,
|
||||||
default_cmd_callback=cmd_callback,
|
default_cmd_callback=cmd_callback,
|
||||||
|
@ -1222,6 +1222,19 @@ class TestDhcpLocalProcess(TestBase):
|
|||||||
self.assertEqual(lp.called, ['spawn'])
|
self.assertEqual(lp.called, ['spawn'])
|
||||||
self.assertTrue(self.mock_mgr.return_value.setup.called)
|
self.assertTrue(self.mock_mgr.return_value.setup.called)
|
||||||
|
|
||||||
|
def test_get_process_uuid(self):
|
||||||
|
net = FakeV4Network()
|
||||||
|
|
||||||
|
lp = LocalChild(self.conf, net)
|
||||||
|
self.assertEqual(
|
||||||
|
"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
|
||||||
|
lp._get_process_uuid())
|
||||||
|
|
||||||
|
lp.segment = FakeSegment()
|
||||||
|
self.assertEqual(
|
||||||
|
"1212/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
|
||||||
|
lp._get_process_uuid())
|
||||||
|
|
||||||
@mock.patch.object(fileutils, 'ensure_tree')
|
@mock.patch.object(fileutils, 'ensure_tree')
|
||||||
def test_enable(self, ensure_dir):
|
def test_enable(self, ensure_dir):
|
||||||
attrs_to_mock = dict(
|
attrs_to_mock = dict(
|
||||||
|
Loading…
Reference in New Issue
Block a user