def get_openshift_version(facts):
    """ Get current version of openshift on the host

        Args:
            facts (dict): existing facts
            optional cli_image for pulling the version number

        Returns:
            version: the current openshift version
    """
    version = None

    # No need to run this method repeatedly on a system if we already know the
    # version
    if 'common' in facts:
        if 'version' in facts['common'] and facts['common']['version'] is not None:
            return facts['common']['version']

    if os.path.isfile('/usr/bin/openshift'):
        _, output, _ = module.run_command(['/usr/bin/openshift', 'version'])
        version = parse_openshift_version(output)

    # openshift_facts runs before openshift_docker_facts.  However, it will be
    # called again and set properly throughout the playbook run.  This could be
    # refactored to simply set the openshift.common.version in the
    # openshift_docker_facts role but it would take reworking some assumptions
    # on how get_openshift_version is called.
    if 'is_containerized' in facts['common'] and safe_get_bool(facts['common']['is_containerized']):
        if 'docker' in facts and 'openshift_version' in facts['docker']:
            version = facts['docker']['openshift_version']

    return version
dataset/ETHPy150Open openshift/openshift-ansible/roles/openshift_facts/library/openshift_facts.py/get_openshift_version/original