in ccmlib/cluster.py [0:0]
def __init__(self, path, name, partitioner=None, install_dir=None, create_directory=True, version=None, verbose=False, derived_cassandra_version=None, options=None, **kwargs):
self.name = name
self.nodes = {}
self.seeds = []
self.partitioner = partitioner
self._config_options = {}
self._dse_config_options = {}
self._misc_config_options = {}
self._environment_variables = {}
self.__log_level = "INFO"
self.__path = path
self.__version = None
self.use_vnodes = False
self.configuration_yaml = options.configuration_yaml if options else None
# Classes that are to follow the respective logging level
self._debug = []
self._trace = []
self.data_dir_count = 1
if self.name.lower() == "current":
raise RuntimeError("Cannot name a cluster 'current'.")
# This is incredibly important for
# backwards compatibility.
if 'cassandra_version' in kwargs:
version = kwargs['cassandra_version']
if 'cassandra_dir' in kwargs:
install_dir = kwargs['cassandra_dir']
if create_directory:
# we create the dir before potentially downloading to throw an error sooner if need be
os.mkdir(self.get_path())
try:
if version is None:
# at this point, install_dir should always not be None, but
# we keep this for backward compatibility (in loading old cluster)
if install_dir is not None:
if common.is_win():
self.__install_dir = install_dir
else:
self.__install_dir = os.path.abspath(install_dir)
else:
repo_dir, v = self.load_from_repository(version, verbose)
self.__install_dir = repo_dir
self.__version = v
if self.__version is None:
if derived_cassandra_version is not None:
self.__version = derived_cassandra_version
else:
self.__version = self.__get_version_from_build()
if create_directory:
common.validate_install_dir(self.__install_dir)
self._update_config()
except:
if create_directory:
common.rmdirs(self.get_path())
raise