コード例 #1
0
    def __init__(self, path, name, partitioner=None, cassandra_dir=None, create_directory=True, cassandra_version=None, verbose=False):
        self.name = name
        self.nodes = {}
        self.seeds = []
        self.partitioner = partitioner
        self._config_options = {}
        self.__log_level = "INFO"
        self.__path = path
        self.__version = None
        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 cassandra_version is None:
                # at this point, cassandra_dir should always not be None, but
                # we keep this for backward compatibility (in loading old cluster)
                if cassandra_dir is not None:
                    if common.is_win():
                        self.__cassandra_dir = cassandra_dir
                    else:
                        self.__cassandra_dir = os.path.abspath(cassandra_dir)
                    self.__version = self.__get_version_from_build()
            else:
                dir, v = repository.setup(cassandra_version, verbose)
                self.__cassandra_dir = dir
                self.__version = v if v is not None else self.__get_version_from_build()

            if create_directory:
                common.validate_cassandra_dir(self.__cassandra_dir)
                self.__update_config()
        except:
            if create_directory:
                shutil.rmtree(self.get_path())
            raise
コード例 #2
0
ファイル: cluster.py プロジェクト: EnigmaCurry/ccm
    def __init__(self, path, name, partitioner=None, cassandra_dir=None, create_directory=True, cassandra_version=None, verbose=False):
        self.name = name
        self.nodes = {}
        self.seeds = []
        self.partitioner = partitioner
        self._config_options = {}
        self.__log_level = "INFO"
        self.__path = path
        self.__version = None
        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 cassandra_version is None:
                # at this point, cassandra_dir should always not be None, but
                # we keep this for backward compatibility (in loading old cluster)
                if cassandra_dir is not None:
                    if common.is_win():
                        self.__cassandra_dir = cassandra_dir
                    else:
                        self.__cassandra_dir = os.path.abspath(cassandra_dir)
                    self.__version = self.__get_version_from_build()
            else:
                dir, v = repository.setup(cassandra_version, verbose)
                self.__cassandra_dir = dir
                self.__version = v if v is not None else self.__get_version_from_build()

            if create_directory:
                common.validate_cassandra_dir(self.__cassandra_dir)
                self.__update_config()
        except:
            if create_directory:
                shutil.rmtree(self.get_path())
            raise
コード例 #3
0
ファイル: node.py プロジェクト: EnigmaCurry/ccm
 def get_cassandra_dir(self):
     """
     Returns the path to the cassandra source directory used by this node.
     """
     if self.__cassandra_dir is None:
         return self.cluster.get_cassandra_dir()
     else:
         common.validate_cassandra_dir(self.__cassandra_dir)
         return self.__cassandra_dir
コード例 #4
0
ファイル: node.py プロジェクト: jsanda/ccm
 def get_cassandra_dir(self):
     """
     Returns the path to the cassandra source directory used by this node.
     """
     if self.__cassandra_dir is None:
         return self.cluster.get_cassandra_dir()
     else:
         common.validate_cassandra_dir(self.__cassandra_dir)
         return self.__cassandra_dir
コード例 #5
0
ファイル: repository.py プロジェクト: aeriksson/ccm
def version_directory(version):
    version = version.replace(':', '_') # handle git branches like 'git:trunk'.
    dir = os.path.join(__get_dir(), version)
    if os.path.exists(dir):
        try:
            validate_cassandra_dir(dir)
            return dir
        except ArgumentError as e:
            shutil.rmtree(dir)
            return None
    else:
        return None
コード例 #6
0
ファイル: node.py プロジェクト: EnigmaCurry/ccm
 def set_cassandra_dir(self, cassandra_dir=None, cassandra_version=None, verbose=False):
     """
     Sets the path to the cassandra source directory for use by this node.
     """
     if cassandra_version is None:
         self.__cassandra_dir = cassandra_dir
         if cassandra_dir is not None:
             common.validate_cassandra_dir(cassandra_dir)
     else:
         dir, v = setup(cassandra_version, verbose=verbose)
         self.__cassandra_dir = dir
     self.import_config_files()
     return self
コード例 #7
0
 def set_cassandra_dir(self, cassandra_dir=None, cassandra_version=None, verbose=False):
     if cassandra_version is None:
         self.__cassandra_dir = cassandra_dir
         common.validate_cassandra_dir(cassandra_dir)
         self.__version = self.__get_version_from_build()
     else:
         dir, v = repository.setup(cassandra_version, verbose)
         self.__cassandra_dir = dir
         self.__version = v if v is not None else self.__get_version_from_build()
     self.__update_config()
     for node in list(self.nodes.values()):
         node.import_config_files()
     return self
コード例 #8
0
ファイル: node.py プロジェクト: jsanda/ccm
 def set_cassandra_dir(self, cassandra_dir=None, cassandra_version=None, verbose=False):
     """
     Sets the path to the cassandra source directory for use by this node.
     """
     if cassandra_version is None:
         self.__cassandra_dir = cassandra_dir
         if cassandra_dir is not None:
             common.validate_cassandra_dir(cassandra_dir)
     else:
         dir, v = setup(cassandra_version, verbose=verbose)
         self.__cassandra_dir = dir
     self.import_config_files()
     return self
コード例 #9
0
ファイル: repository.py プロジェクト: kapyar/ccm
def version_directory(version):
    version = version.replace(':',
                              '_')  # handle git branches like 'git:trunk'.
    dir = os.path.join(__get_dir(), version)
    if os.path.exists(dir):
        try:
            validate_cassandra_dir(dir)
            return dir
        except ArgumentError as e:
            shutil.rmtree(dir)
            return None
    else:
        return None
コード例 #10
0
ファイル: cluster.py プロジェクト: EnigmaCurry/ccm
 def set_cassandra_dir(self, cassandra_dir=None, cassandra_version=None, verbose=False):
     if cassandra_version is None:
         self.__cassandra_dir = cassandra_dir
         common.validate_cassandra_dir(cassandra_dir)
         self.__version = self.__get_version_from_build()
     else:
         dir, v = repository.setup(cassandra_version, verbose)
         self.__cassandra_dir = dir
         self.__version = v if v is not None else self.__get_version_from_build()
     self.__update_config()
     for node in list(self.nodes.values()):
         node.import_config_files()
     
     # if any nodes have a data center, let's update the topology
     if any( [node.data_center for node in self.nodes.values()] ):
         self.__update_topology_files()
     
     return self
コード例 #11
0
    def set_cassandra_dir(self, cassandra_dir=None, cassandra_version=None, verbose=False):
        if cassandra_version is None:
            self.__cassandra_dir = cassandra_dir
            common.validate_cassandra_dir(cassandra_dir)
            self.__version = self.__get_version_from_build()
        else:
            dir, v = repository.setup(cassandra_version, verbose)
            self.__cassandra_dir = dir
            self.__version = v if v is not None else self.__get_version_from_build()
        self.__update_config()
        for node in list(self.nodes.values()):
            node.import_config_files()

        # if any nodes have a data center, let's update the topology
        if any( [node.data_center for node in self.nodes.values()] ):
            self.__update_topology_files()

        return self
コード例 #12
0
ファイル: cluster.py プロジェクト: EnigmaCurry/ccm
 def get_cassandra_dir(self):
     common.validate_cassandra_dir(self.__cassandra_dir)
     return self.__cassandra_dir
コード例 #13
0
 def get_cassandra_dir(self):
     common.validate_cassandra_dir(self.__cassandra_dir)
     return self.__cassandra_dir