예제 #1
0
  def _GetVersions(self, image_packages, image_name):
    package_versions = {}
    for occurrence in image_packages:
      package_name = occurrence.installation.name
      versions = []
      for location in occurrence.installation.location:
        versions.append((location.version.name, location.version.revision))
      package_versions[package_name] = versions

    if not package_versions:
      raise exceptions.ImagePackagesInfoUnavailableException(image_name)

    return package_versions
예제 #2
0
  def _GetPackageVersions(self, image_packages, image_name):
    package_versions = []
    for occurrence in image_packages:
      package_name = occurrence.installation.name
      for location in occurrence.installation.location:
        package_version = {'name': package_name,
                           'version': location.version.name,
                           'revision': location.version.revision}
        package_versions.append(package_version)

    if not package_versions:
      raise exceptions.ImagePackagesInfoUnavailableException(image_name)

    return sorted(package_versions,
                  key=lambda package_version: package_version['name'])