libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r1443563 - in /libcloud/branches/0.12.x: ./ CHANGES libcloud/compute/drivers/ec2.py libcloud/test/compute/test_ec2.py
Date Thu, 07 Feb 2013 15:39:26 GMT
Author: tomaz
Date: Thu Feb  7 15:39:26 2013
New Revision: 1443563

URL: http://svn.apache.org/viewvc?rev=1443563&view=rev
Log:
Backport changes from trunk.

Modified:
    libcloud/branches/0.12.x/   (props changed)
    libcloud/branches/0.12.x/CHANGES
    libcloud/branches/0.12.x/libcloud/compute/drivers/ec2.py
    libcloud/branches/0.12.x/libcloud/test/compute/test_ec2.py

Propchange: libcloud/branches/0.12.x/
------------------------------------------------------------------------------
  Merged /libcloud/trunk:r1443252-1443562

Modified: libcloud/branches/0.12.x/CHANGES
URL: http://svn.apache.org/viewvc/libcloud/branches/0.12.x/CHANGES?rev=1443563&r1=1443562&r2=1443563&view=diff
==============================================================================
--- libcloud/branches/0.12.x/CHANGES (original)
+++ libcloud/branches/0.12.x/CHANGES Thu Feb  7 15:39:26 2013
@@ -149,6 +149,10 @@ Changes with Apache Libcloud 0.12.0:
      attribute is not present in the response.
      [Gavin McCance, Tomaz Muraus]
 
+   - Allow users to filter images returned by the list_images method in the EC2
+     driver by providing ex_image_ids argument. (LIBCLOUD-294)
+     [Chris Psaltis, Joseph Hall]
+
   *) Storage
 
     - Add a new local storage driver.

Modified: libcloud/branches/0.12.x/libcloud/compute/drivers/ec2.py
URL: http://svn.apache.org/viewvc/libcloud/branches/0.12.x/libcloud/compute/drivers/ec2.py?rev=1443563&r1=1443562&r2=1443563&view=diff
==============================================================================
--- libcloud/branches/0.12.x/libcloud/compute/drivers/ec2.py (original)
+++ libcloud/branches/0.12.x/libcloud/compute/drivers/ec2.py Thu Feb  7 15:39:26 2013
@@ -644,8 +644,24 @@ class BaseEC2NodeDriver(NodeDriver):
             sizes.append(NodeSize(driver=self, **attributes))
         return sizes
 
-    def list_images(self, location=None):
+    def list_images(self, location=None, ex_image_ids=None):
+        """
+        List all images
+
+        Ex_image_ids parameter is used to filter the list of
+        images that should be returned. Only the images
+        with the corresponding image ids will be returned.
+
+        @param      ex_image_ids: List of C{NodeImage.id}
+        @type       ex_image_ids: C{list} of C{str}
+
+        @rtype: C{list} of L{NodeImage}
+        """
         params = {'Action': 'DescribeImages'}
+
+        if ex_image_ids:
+            params.update(self._pathlist('ImageId', ex_image_ids))
+
         images = self._to_images(
             self.connection.request(self.path, params=params).object
         )

Modified: libcloud/branches/0.12.x/libcloud/test/compute/test_ec2.py
URL: http://svn.apache.org/viewvc/libcloud/branches/0.12.x/libcloud/test/compute/test_ec2.py?rev=1443563&r1=1443562&r2=1443563&view=diff
==============================================================================
--- libcloud/branches/0.12.x/libcloud/test/compute/test_ec2.py (original)
+++ libcloud/branches/0.12.x/libcloud/test/compute/test_ec2.py Thu Feb  7 15:39:26 2013
@@ -245,6 +245,12 @@ class EC2Tests(LibcloudTestCase, TestCas
                     'ec2-public-images/fedora-8-i386-base-v1.04.manifest.xml')
         self.assertEqual(image.id, 'ami-be3adfd7')
 
+    def test_list_images_with_image_ids(self):
+        images = self.driver.list_images(ex_image_ids=['ami-be3adfd7'])
+        self.assertEqual(len(images), 1)
+        self.assertEqual(images[0].name,
+                    'ec2-public-images/fedora-8-i386-base-v1.04.manifest.xml')
+
     def test_ex_list_availability_zones(self):
         availability_zones = self.driver.ex_list_availability_zones()
         availability_zone = availability_zones[0]



Mime
View raw message