def test_set_missing_no_topology(self, set_conf_mock, set_env_mock): env.topology_config_not_found = True topology.set_topology_if_missing() self.assertTrue(set_conf_mock.called) self.assertTrue(set_env_mock.called) self.assertFalse(env.topology_config_not_found)
def install(local_path): """ Install the rpm package on the cluster Args: local_path: Absolute path to the rpm to be installed --nodeps (optional): Flag to indicate if rpm install should ignore checking package dependencies. Equivalent to adding --nodeps flag to rpm -i. """ topology.set_topology_if_missing() execute(deploy_install, local_path, hosts=get_host_list())
def test_interactive_install(self, get_conf_mock, mock_set_interactive): env.topology_config_not_found = ConfigurationError() get_conf_mock.return_value = {'username': '******', 'port': '225', 'coordinator': 'master', 'workers': ['slave1', 'slave2']} topology.set_topology_if_missing() self.assertEqual(env.user, 'bob'), self.assertEqual(env.port, '225') self.assertEqual(env.hosts, ['master', 'slave1', 'slave2']) self.assertEqual(env.roledefs['all'], ['master', 'slave1', 'slave2']) self.assertEqual(env.roledefs['coordinator'], ['master']) self.assertEqual(env.roledefs['worker'], ['slave1', 'slave2']) self.assertFalse(env.topology_config_not_found)
def test_interactive_install(self, get_conf_mock, mock_set_interactive): env.topology_config_not_found = ConfigurationError() get_conf_mock.return_value = { 'username': '******', 'port': '225', 'coordinator': 'master', 'workers': ['slave1', 'slave2'] } topology.set_topology_if_missing() self.assertEqual(env.user, 'bob'), self.assertEqual(env.port, '225') self.assertEqual(env.hosts, ['master', 'slave1', 'slave2']) self.assertEqual(env.roledefs['all'], ['master', 'slave1', 'slave2']) self.assertEqual(env.roledefs['coordinator'], ['master']) self.assertEqual(env.roledefs['worker'], ['slave1', 'slave2']) self.assertFalse(env.topology_config_not_found)
def install(local_path): """ Copy and install the presto-server rpm to all the nodes in the cluster and configure the nodes. The topology information will be read from the config.json file. If this file is missing, then the coordinator and workers will be obtained interactively. Install will fail for invalid json configuration. The connector configurations will be read from the directory /etc/opt/prestoadmin/connectors. If this directory is missing or empty then no connector configuration is deployed. Install will fail for incorrectly formatted configuration files. Expected format is key=value for .properties files and one option per line for jvm.config Parameters: local_path - Absolute path to the presto rpm to be installed """ topology.set_topology_if_missing() execute(deploy_install_configure, local_path, hosts=get_host_list())