.. warning::
        This combiner methode is deprecated, please use
        :py:class:`insights.combiners.redhat_release.RedHatRelease` instead.

    Combiner method to check uname and redhat-release for rhel major/minor
    version.

    Prefer uname to redhat-release.

    Returns:
        Release: A named tuple with the following items:
            - major: integer
            - minor: integer

    Raises:
        ParseException: If the version can't be determined even though a Uname
            or RedhatRelease was provided.

    Examples:
        >>> rh_release.major
        7
        >>> rh_release.minor
        2
        >>> rh_release
        Release(major=7, minor=2)

def redhat_release(rh_release, un):
    """
    .. warning::
        This combiner methode is deprecated, please use
        :py:class:`insights.combiners.redhat_release.RedHatRelease` instead.

    Combiner method to check uname and redhat-release for rhel major/minor
    version.

    Prefer uname to redhat-release.

    Returns:
        Release: A named tuple with the following items:
            - major: integer
            - minor: integer

    Raises:
        ParseException: If the version can't be determined even though a Uname
            or RedhatRelease was provided.

    Examples:
        >>> rh_release.major
        7
        >>> rh_release.minor
        2
        >>> rh_release
        Release(major=7, minor=2)

    """

    deprecated(redhat_release, "Use the `RedHatRelease` class instead.")

    if un and un.release_tuple[0] != -1:
        return Release(*un.release_tuple)

    if rh_release:
        return Release(rh_release.major, rh_release.minor)

    raise ParseException("Unabled to determine release.")