From 6847377d9ac0b442c8e3b20a2cea64eeb80b6c0c Mon Sep 17 00:00:00 2001 From: Alex Schultz Date: Thu, 19 Oct 2017 15:17:22 -0600 Subject: [PATCH] Ensure networks are running before starting node If you create an environment and want to start a node prior to running the admin setup action, it will fail because the networks are not currently started. This change makes sure the networks are started before starting the node via the node-start shell command. Change-Id: I336ea88950e9239d02d3c72c49b3d17eb264e6c3 --- devops/shell.py | 3 +++ devops/tests/test_shell.py | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/devops/shell.py b/devops/shell.py index 834c9e81..8a14f711 100644 --- a/devops/shell.py +++ b/devops/shell.py @@ -417,6 +417,9 @@ class Shell(object): self.env.get_admin_ip())) def do_node_start(self): + # ensure networks are running prior to starting a node + for group in self.env.get_groups(): + group.start_networks() # TODO(astudenov): add positional argument instead of # checking that option is present self.check_param_show_help(self.params.node_name) diff --git a/devops/tests/test_shell.py b/devops/tests/test_shell.py index 13b2d7f3..ab630079 100644 --- a/devops/tests/test_shell.py +++ b/devops/tests/test_shell.py @@ -679,9 +679,13 @@ class TestShell(unittest.TestCase): iface='eth1') def test_node_start(self): + group = mock.Mock(spec=models.Group) + self.env_mocks['env1'].get_groups.return_value = [group] + sh = shell.Shell(['node-start', 'env1', '-N', 'slave-01']) sh.execute() + group.start_networks.assert_called_once_with() self.client_inst.get_env.assert_called_once_with('env1') self.nodes['env1']['slave-01'].start.assert_called_once_with()