libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r1345525 - in /libcloud/trunk: CHANGES libcloud/compute/drivers/cloudstack.py test/compute/test_cloudstack.py
Date Sat, 02 Jun 2012 15:37:39 GMT
Author: tomaz
Date: Sat Jun  2 15:37:38 2012
New Revision: 1345525

URL: http://svn.apache.org/viewvc?rev=1345525&view=rev
Log:
Make CloudStuck driver more robust and make it work if list_images() call
returns no images. Contributed by Gabriel Reid, part of LIBCLOUD-202.

Modified:
    libcloud/trunk/CHANGES
    libcloud/trunk/libcloud/compute/drivers/cloudstack.py
    libcloud/trunk/test/compute/test_cloudstack.py

Modified: libcloud/trunk/CHANGES
URL: http://svn.apache.org/viewvc/libcloud/trunk/CHANGES?rev=1345525&r1=1345524&r2=1345525&view=diff
==============================================================================
--- libcloud/trunk/CHANGES (original)
+++ libcloud/trunk/CHANGES Sat Jun  2 15:37:38 2012
@@ -14,6 +14,10 @@ Changes with Apache Libcloud in developm
     - Fix a bug with Python 3 support in IBM SCE driver. ; LIBCLOUD-204
       [Sengor Kusturica, Hutson Betts]
 
+    - Make CloudStuck driver more robust and make it work if list_images() call
+      returns no images. ; LIBCLOUD-202
+      [Gabriel Reid]
+
   *) DNS:
     - Add support for GEO RecordType to Zerigo driver. ; LIBCLOUD-203
       [Gary Wilson]

Modified: libcloud/trunk/libcloud/compute/drivers/cloudstack.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/compute/drivers/cloudstack.py?rev=1345525&r1=1345524&r2=1345525&view=diff
==============================================================================
--- libcloud/trunk/libcloud/compute/drivers/cloudstack.py (original)
+++ libcloud/trunk/libcloud/compute/drivers/cloudstack.py Sat Jun  2 15:37:38 2012
@@ -124,7 +124,7 @@ class CloudStackNodeDriver(CloudStackDri
             args['zoneid'] = location.id
         imgs = self._sync_request('listTemplates', **args)
         images = []
-        for img in imgs['template']:
+        for img in imgs.get('template', []):
             images.append(NodeImage(img['id'], img['name'], self, {
                 'hypervisor': img['hypervisor'],
                 'format': img['format'],

Modified: libcloud/trunk/test/compute/test_cloudstack.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/compute/test_cloudstack.py?rev=1345525&r1=1345524&r2=1345525&view=diff
==============================================================================
--- libcloud/trunk/test/compute/test_cloudstack.py (original)
+++ libcloud/trunk/test/compute/test_cloudstack.py Sat Jun  2 15:37:38 2012
@@ -58,6 +58,12 @@ class CloudStackNodeDriverTest(unittest.
             return
         self.assertTrue(False)
 
+    def test_list_images_no_images_available(self):
+        CloudStackMockHttp.fixture_tag = 'notemplates'
+
+        images = self.driver.list_images()
+        self.assertEquals(0, len(images))
+
 class CloudStackMockHttp(MockHttpTestCase):
     fixtures = ComputeFileFixtures('cloudstack')
     fixture_tag = 'default'



Mime
View raw message