You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2013/11/22 00:56:37 UTC
git commit: Modify GCE driver to be more robust and not explode if
the 'description' attribute is not present in the node image object.
Updated Branches:
refs/heads/trunk 0b50e6c29 -> 4e4945222
Modify GCE driver to be more robust and not explode if the 'description'
attribute is not present in the node image object.
Signed-off-by: Tomaz Muraus <to...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/4e494522
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/4e494522
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/4e494522
Branch: refs/heads/trunk
Commit: 4e4945222a63afc5564abf01cd39851dfb691b66
Parents: 0b50e6c
Author: gigimon <gi...@gmail.com>
Authored: Wed Nov 20 16:08:30 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Nov 22 00:53:09 2013 +0100
----------------------------------------------------------------------
libcloud/compute/drivers/gce.py | 2 +-
libcloud/test/compute/fixtures/gce/global_images.json | 14 ++++++++++++++
libcloud/test/compute/test_gce.py | 3 ++-
3 files changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/4e494522/libcloud/compute/drivers/gce.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/gce.py b/libcloud/compute/drivers/gce.py
index c0ee559..6910fdf 100644
--- a/libcloud/compute/drivers/gce.py
+++ b/libcloud/compute/drivers/gce.py
@@ -2470,7 +2470,7 @@ class GCENodeDriver(NodeDriver):
"""
extra = {}
extra['preferredKernel'] = image['preferredKernel']
- extra['description'] = image['description']
+ extra['description'] = image.get('description', None)
extra['creationTimestamp'] = image['creationTimestamp']
extra['selfLink'] = image['selfLink']
return NodeImage(id=image['id'], name=image['name'], driver=self,
http://git-wip-us.apache.org/repos/asf/libcloud/blob/4e494522/libcloud/test/compute/fixtures/gce/global_images.json
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/gce/global_images.json b/libcloud/test/compute/fixtures/gce/global_images.json
index 59b9d34..bfddba5 100644
--- a/libcloud/test/compute/fixtures/gce/global_images.json
+++ b/libcloud/test/compute/fixtures/gce/global_images.json
@@ -15,6 +15,20 @@
"selfLink": "https://www.googleapis.com/compute/v1beta16/projects/debian-cloud/global/images/debian-7-wheezy-v20130617",
"sourceType": "RAW",
"status": "READY"
+ },
+ {
+ "creationTimestamp": "2013-11-18T12:24:21.560-07:00",
+ "id": "1539141992335368259",
+ "kind": "compute#image",
+ "name": "centos-6-v20131118",
+ "preferredKernel": "https://www.googleapis.com/compute/v1beta16/projects/google/global/kernels/gce-v20130603",
+ "rawDisk": {
+ "containerType": "TAR",
+ "source": ""
+ },
+ "selfLink": "https://www.googleapis.com/compute/v1beta16/projects/debian-cloud/global/images/centos-6-v20131118",
+ "sourceType": "RAW",
+ "status": "READY"
}
],
"kind": "compute#imageList",
http://git-wip-us.apache.org/repos/asf/libcloud/blob/4e494522/libcloud/test/compute/test_gce.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_gce.py b/libcloud/test/compute/test_gce.py
index cbb6811..52c462a 100644
--- a/libcloud/test/compute/test_gce.py
+++ b/libcloud/test/compute/test_gce.py
@@ -136,9 +136,10 @@ class GCENodeDriverTest(LibcloudTestCase, TestCaseMixin):
def test_list_images(self):
local_images = self.driver.list_images()
debian_images = self.driver.list_images(ex_project='debian-cloud')
- self.assertEqual(len(local_images), 1)
+ self.assertEqual(len(local_images), 2)
self.assertEqual(len(debian_images), 17)
self.assertEqual(local_images[0].name, 'debian-7-wheezy-v20130617')
+ self.assertEqual(local_images[1].name, 'centos-6-v20131118')
def test_list_locations(self):
locations = self.driver.list_locations()