def get_distroinfo(distro=None):
    """Get DistroInfo initialized from configuration"""
    if not distro:
        distro = cfg['DISTRO']
    _info_file = info_file(distro)
    # prefer git fetcher if available
    git_info_url_conf = distro.upper() + 'INFO_REPO'
    try:
        remote_git_info = cfg[git_info_url_conf]
        return DistroInfo(_info_file, remote_git_info=remote_git_info)
    except KeyError:
        pass
    # try raw remote fetcher
    remote_info_url_conf = distro.upper() + 'INFO_RAW_URL'
    try:
        remote_info = cfg[remote_info_url_conf]
        return DistroInfo(_info_file, remote_info=remote_info)
    except KeyError:
        raise exception.InvalidUsage(
            why="Couldn't find config option %s or %s for distro: %s"
                % (git_info_url_conf, remote_info_url_conf, distro))
Get DistroInfo initialized from configuration