def run(self): try: current = common.current_cluster_name(self.path) except Exception as e: current = '' for dir in os.listdir(self.path): if os.path.exists(os.path.join(self.path, dir, 'cluster.conf')): print_(" %s%s" % ('*' if current == dir else ' ', dir))
def run(self): try: current = common.current_cluster_name(self.path) except Exception as e: current = "" for dir in os.listdir(self.path): if os.path.exists(os.path.join(self.path, dir, "cluster.conf")): print_(" %s%s" % ("*" if current == dir else " ", dir))
def _load_current_cluster(self): name = common.current_cluster_name(self.path) if name is None: print_('No currently active cluster (use ccm cluster switch)') exit(1) try: return ClusterFactory.load(self.path, name) except common.LoadError as e: print_(str(e)) exit(1)
def run(self): if self.other_cluster: # Remove the specified cluster: cluster = ClusterFactory.load(self.path, self.other_cluster) cluster.remove() # Remove CURRENT flag if the specified cluster is the current cluster: if self.other_cluster == common.current_cluster_name(self.path): os.remove(os.path.join(self.path, 'CURRENT')) else: # Remove the current cluster: self.cluster.remove() os.remove(os.path.join(self.path, 'CURRENT'))
def run(self): if self.other_cluster: # Remove the specified cluster: cluster = Cluster.load(self.path, self.other_cluster) cluster.remove() # Remove CURRENT flag if the specified cluster is the current cluster: if self.other_cluster == common.current_cluster_name(self.path): os.remove(os.path.join(self.path, 'CURRENT')) else: # Remove the current cluster: self.cluster.remove() os.remove(os.path.join(self.path, 'CURRENT'))
def cluster_create_no_switch_test(self): self.create_cmd(args=None, name='not_test') args = ['--no-switch'] self.validate_output(self.create_cmd(args)) self.assertEqual('not_test', common.current_cluster_name(common.get_default_path())) p = subprocess.Popen(['ccm', 'remove']) p.wait() p = subprocess.Popen(['ccm', 'switch', 'test']) p.wait() p = subprocess.Popen(['ccm', 'remove']) p.wait()
def _tuple_version(version_string): if '-' in version_string: version_string = version_string[:version_string.index('-')] return tuple([int(p) for p in version_string.split('.')]) USE_CASS_EXTERNAL = bool(os.getenv('USE_CASS_EXTERNAL', False)) default_cassandra_version = '2.1.3' if USE_CASS_EXTERNAL: if CCMClusterFactory: # see if the external instance is running in ccm path = common.get_default_path() name = common.current_cluster_name(path) CCM_CLUSTER = CCMClusterFactory.load(common.get_default_path(), name) CCM_CLUSTER.start(wait_for_binary_proto=True, wait_other_notice=True) # Not sure what's going on, but the server version query # hangs in python3. This appears to be related to running inside of # nosetests, and only for this query that would run while loading the # module. # This is a hack to make it run with default cassandra version for PY3. # Not happy with it, but need to move on for now. if not six.PY3: cass_ver, _ = get_server_versions() default_cassandra_version = '.'.join('%d' % i for i in cass_ver) else: if not os.getenv('CASSANDRA_VERSION'): log.warning("Using default C* version %s because external server cannot be queried" % default_cassandra_version)
def _tuple_version(version_string): if '-' in version_string: version_string = version_string[:version_string.index('-')] return tuple([int(p) for p in version_string.split('.')]) USE_CASS_EXTERNAL = bool(os.getenv('USE_CASS_EXTERNAL', False)) default_cassandra_version = '2.1.3' if USE_CASS_EXTERNAL: if CCMClusterFactory: # see if the external instance is running in ccm path = common.get_default_path() name = common.current_cluster_name(path) CCM_CLUSTER = CCMClusterFactory.load(common.get_default_path(), name) CCM_CLUSTER.start(wait_for_binary_proto=True, wait_other_notice=True) # Not sure what's going on, but the server version query # hangs in python3. This appears to be related to running inside of # nosetests, and only for this query that would run while loading the # module. # This is a hack to make it run with default cassandra version for PY3. # Not happy with it, but need to move on for now. if not six.PY3: cass_ver, _ = get_server_versions() default_cassandra_version = '.'.join('%d' % i for i in cass_ver) else: if not os.getenv('CASSANDRA_VERSION'): log.warning(