Example #1
0
 def testPseudoImages(self):
     for project, data in vm_images.PROJECT_IMAGES.iteritems():
         if not 'pseudo' in data:
             continue
         for pseudo in data['pseudo']:
             self.assertEqual(
                 self.projectImageToUrl(project, data['pseudo'][pseudo]),
                 vm_images.ImageShortNameToUrl(pseudo))
Example #2
0
    def resolve(cls, image, project=None):
        """
    Args:
      image (string): short name of the image
      project (string): (optional) project name

    Returns:
      string (URL pointing to the VM image)
    """
        if project is None:
            project = GCE.project()

        # TODO(mbrukman): custom images within the project should override default
        # images. For now, we will depend on them having distinct names. This also
        # allows us to select the image URL without a network call.
        try:
            return vm_images.ImageShortNameToUrl(image)
        except:
            return common.ImageToUrl(project, image)
Example #3
0
 def testDirectReferenceImages(self):
     for project, data in vm_images.PROJECT_IMAGES.iteritems():
         for image in data['images']:
             self.assertEqual(self.projectImageToUrl(project, image),
                              vm_images.ImageShortNameToUrl(image))