def openstack_upgrade_available(package):
    """
    Determines if an OpenStack upgrade is available from installation
    source, based on version of installed package.

    :param package: str: Name of installed package.

    :returns: bool:    : Returns True if configured installation source offers
                         a newer version of package.
    """

    import apt_pkg as apt
    src = config('openstack-origin')
    cur_vers = get_os_version_package(package)
    if not cur_vers:
        # The package has not been installed yet do not attempt upgrade
        return False
    if "swift" in package:
        codename = get_os_codename_install_source(src)
        avail_vers = get_os_version_codename_swift(codename)
    else:
        avail_vers = get_os_version_install_source(src)
    apt.init()
    return apt.version_compare(avail_vers, cur_vers) >= 1
def openstack_upgrade_available ( package ) : import apt_pkg as apt src = config ( 'openstack-origin' ) cur_vers = get_os_version_package ( package ) if not cur_vers : return False if "swift" in package : codename = get_os_codename_install_source ( src ) avail_vers = get_os_version_codename_swift ( codename ) else : avail_vers = get_os_version_install_source ( src ) apt . init ( ) return apt . version_compare ( avail_vers , cur_vers ) >= 1
Determines if an OpenStack upgrade is available from installation
    source, based on version of installed package.

    :param package: str: Name of installed package.

    :returns: bool:    : Returns True if configured installation source offers
                         a newer version of package.