Explorar el Código

Fix errors in image.find()

Nuwan Goonasekera hace 10 años
padre
commit
b1d517190a
Se han modificado 2 ficheros con 6 adiciones y 6 borrados
  1. 1 1
      cloudbridge/cloud/providers/aws/services.py
  2. 5 5
      test/test_image_service.py

+ 1 - 1
cloudbridge/cloud/providers/aws/services.py

@@ -396,7 +396,7 @@ class AWSImageService(BaseImageService):
         """
         Searches for an image by a given list of attributes
         """
-        filters = {'tag:Name': name}
+        filters = {'name': name}
         images = [AWSMachineImage(self.provider, image) for image in
                   self.provider.ec2_conn.get_all_images(filters=filters)]
         return ClientPagedResultList(self.provider, images,

+ 5 - 5
test/test_image_service.py

@@ -65,16 +65,16 @@ class CloudImageServiceTestCase(ProviderTestBase):
                 found_images = self.provider.compute.images.find(name=name)
                 self.assertTrue(
                     len(found_images) == 1,
-                    "Iter images does not return the expected image %s" %
-                    name)
+                    "Find images error: expected image %s but found: %s" %
+                    (name, found_images))
 
                 # check non-existent find
-                found_images = self.provider.compute.images.find(
+                ne_images = self.provider.compute.images.find(
                     name="non_existent")
                 self.assertTrue(
-                    len(found_images) == 0,
+                    len(ne_images) == 0,
                     "Find() for a non-existent image returned %s" %
-                    found_images)
+                    ne_images)
 
                 get_img = self.provider.compute.images.get(
                     test_image.id)