def isHcd()

in ccmlib/hcd/hcd_cluster.py [0:0]


def isHcd(install_dir, options=None):
    if install_dir is None:
        raise ArgumentError('Undefined installation directory')
    bin_dir = os.path.join(install_dir, common.BIN_DIR)
    if options and options.hcd and './' != install_dir and not os.path.exists(bin_dir):
        raise ArgumentError('Installation directory does not contain a bin directory: %s' % install_dir)
    if options and options.hcd:
        return True
    hcd_script = os.path.join(bin_dir, 'hcd')
    if options and not options.hcd and './' != install_dir and os.path.exists(hcd_script):
        raise ArgumentError('Installation directory is HCD but options did not specify `--hcd`: %s' % install_dir)

    return os.path.exists(hcd_script)