in ccmlib/hcd/hcd_node.py [0:0]
def get_version_from_build(install_dir=None, node_path=None, cassandra=False):
if install_dir is None and node_path is not None:
install_dir = node.get_install_dir_from_cluster_conf(node_path)
if install_dir is not None:
# Binary cassandra installs will have a 0.version.txt file
version_file = os.path.join(install_dir, '0.version.txt')
if os.path.exists(version_file):
with open(version_file) as f:
return LooseVersion(f.read().strip())
# For HCD look for a hcd*.jar and extract the version number
from ccmlib.hcd.hcd_cluster import get_hcd_version
hcd_version = get_hcd_version(install_dir)
if (hcd_version is not None):
if cassandra:
from ccmlib.hcd.hcd_cluster import get_hcd_cassandra_version
return get_hcd_cassandra_version(install_dir)
else:
return LooseVersion(hcd_version)
raise common.CCMError("Cannot find version")