def __init__(self, config, contact_point=None): cassandra_config = config.cassandra self._start_cmd = shlex.split(cassandra_config.start_cmd) self._stop_cmd = shlex.split(cassandra_config.stop_cmd) self._is_ccm = int(shlex.split(cassandra_config.is_ccm)[0]) self._os_has_systemd = self._has_systemd() self._nodetool = Nodetool(cassandra_config) logging.warning('is ccm : {}'.format(self._is_ccm)) config_reader = CassandraConfigReader(cassandra_config.config_file) self._cassandra_config_file = cassandra_config.config_file self._root = config_reader.root self._commitlog_path = config_reader.commitlog_directory self._saved_caches_path = config_reader.saved_caches_directory self._hostname = contact_point if contact_point is not None else config_reader.listen_address self._cql_session_provider = CqlSessionProvider([self._hostname], cassandra_config) self._storage_port = config_reader.storage_port self._native_port = config_reader.native_port self._rpc_port = config_reader.rpc_port self.seeds = config_reader.seeds self.grpc_config = config.grpc self.kubernetes_config = config.kubernetes self.snapshot_service = SnapshotService(config=config).snapshot_service
def test_nodetool_command_with_ssl_false(self): config = configparser.ConfigParser(interpolation=None) config['cassandra'] = { 'nodetool_ssl': 'false', 'nodetool_username': '******', 'nodetool_password': '******', 'nodetool_password_file_path': '/etc/cassandra/jmx.password', 'nodetool_host': '127.0.0.1', 'nodetool_port': '7199' } config["grpc"] = { "enabled": "0" } config['kubernetes'] = { "enabled": "0" } medusa_config = MedusaConfig( file_path=None, storage=None, monitoring=None, cassandra=_namedtuple_from_dict(CassandraConfig, config['cassandra']), ssh=None, checks=None, logging=None, grpc=_namedtuple_from_dict(GrpcConfig, config['grpc']), kubernetes=_namedtuple_from_dict(KubernetesConfig, config['kubernetes']), ) n = Nodetool(medusa_config.cassandra).nodetool expected = ['nodetool', '-u', 'cassandra', '-pw', 'password', '-pwf', '/etc/cassandra/jmx.password', '-h', '127.0.0.1', '-p', '7199'] self.assertEqual(n, expected)
def test_nodetool_command_without_parameter(self): config = configparser.ConfigParser(interpolation=None) config['cassandra'] = {} config["grpc"] = {"enabled": "0"} config['kubernetes'] = {"enabled": "0"} medusa_config = MedusaConfig( storage=None, monitoring=None, cassandra=_namedtuple_from_dict(CassandraConfig, config['cassandra']), ssh=None, checks=None, logging=None, grpc=_namedtuple_from_dict(GrpcConfig, config['grpc']), kubernetes=_namedtuple_from_dict(KubernetesConfig, config['kubernetes']), ) n = Nodetool(medusa_config.cassandra).nodetool self.assertEqual(n, ['nodetool'])
def __init__(self, config): super().__init__(config) self._nodetool = Nodetool(self.config)