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/12/06 19:09:25 UTC
[1/4] git commit: Update docs.
Updated Branches:
refs/heads/trunk 81089a8cd -> 83a7d2663
Update docs.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/a59142ef
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/a59142ef
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/a59142ef
Branch: refs/heads/trunk
Commit: a59142ef931fabd4ed61b9237f2d25571002e190
Parents: 81089a8
Author: Tomaz Muraus <to...@apache.org>
Authored: Fri Dec 6 18:38:12 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Dec 6 18:38:12 2013 +0100
----------------------------------------------------------------------
docs/development.rst | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/a59142ef/docs/development.rst
----------------------------------------------------------------------
diff --git a/docs/development.rst b/docs/development.rst
index d94b5f2..755fb4f 100644
--- a/docs/development.rst
+++ b/docs/development.rst
@@ -23,6 +23,9 @@ Style guide
``tox -e lint``.
Second command fill run flake8 on all the files in the repository.
+And most importantly, follow the existing style in the files you are editing and
+be consistent.
+
Git pre-commit hook
-------------------
[4/4] git commit: Update CHANGES.
Posted by to...@apache.org.
Update CHANGES.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/83a7d266
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/83a7d266
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/83a7d266
Branch: refs/heads/trunk
Commit: 83a7d26637b46d5bd910975f118cded75567305f
Parents: df97607
Author: Tomaz Muraus <to...@apache.org>
Authored: Fri Dec 6 18:55:23 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Dec 6 19:04:55 2013 +0100
----------------------------------------------------------------------
CHANGES | 6 ++++++
1 file changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/83a7d266/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index ed2e4c5..75990f3 100644
--- a/CHANGES
+++ b/CHANGES
@@ -56,6 +56,12 @@ Changes with Apache Libcloud in development
invalid credentials are provided.
[Tomaz Muraus]
+ - Don't throw an exception if a node object is missing an "image" attribute
+ in the list nodes / get node response.
+
+ This could happen if node is in an error state. (LIBCLOUD-455)
+ [Dustin Spicuzza, Tomaz Muraus]
+
*) Storage
- Allow user to specify 'Content-Disposition' header in the CloudFiles
[3/4] git commit: Correctly handling missing 'image' attribute in the
OpenStack list nodes response and add a test case for it.
Posted by to...@apache.org.
Correctly handling missing 'image' attribute in the OpenStack list nodes
response and add a test case for it.
Part of LIBCLOUD-455.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/df97607e
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/df97607e
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/df97607e
Branch: refs/heads/trunk
Commit: df97607ec9fe56126028abc0be788eb5fa86124a
Parents: 991d8f1
Author: Tomaz Muraus <to...@apache.org>
Authored: Fri Dec 6 18:51:09 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Dec 6 19:04:50 2013 +0100
----------------------------------------------------------------------
libcloud/compute/drivers/openstack.py | 8 ++-
.../_servers_detail_ERROR_STATE.json | 66 ++++++++++++++++++++
libcloud/test/compute/test_openstack.py | 14 +++++
3 files changed, 86 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/df97607e/libcloud/compute/drivers/openstack.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/openstack.py b/libcloud/compute/drivers/openstack.py
index 00debd0..7d0958a 100644
--- a/libcloud/compute/drivers/openstack.py
+++ b/libcloud/compute/drivers/openstack.py
@@ -1861,6 +1861,11 @@ class OpenStack_1_1_NodeDriver(OpenStackNodeDriver):
else:
private_ips.extend(ips)
+ # Sometimes 'image' attribute is not present if the node is in an error
+ # state
+ image = api_node.get('image', None)
+ image_id = image.get('id', None) if image else None
+
return Node(
id=api_node['id'],
name=api_node['name'],
@@ -1875,8 +1880,7 @@ class OpenStack_1_1_NodeDriver(OpenStackNodeDriver):
# Docs says "tenantId", but actual is "tenant_id". *sigh*
# Best handle both.
tenantId=api_node.get('tenant_id') or api_node['tenantId'],
- # sometimes the image is not set if openstack is in an error state
- imageId=api_node.get('image', {}).get('id', None),
+ imageId=image_id,
flavorId=api_node['flavor']['id'],
uri=next(link['href'] for link in api_node['links'] if
link['rel'] == 'self'),
http://git-wip-us.apache.org/repos/asf/libcloud/blob/df97607e/libcloud/test/compute/fixtures/openstack_v1.1/_servers_detail_ERROR_STATE.json
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/openstack_v1.1/_servers_detail_ERROR_STATE.json b/libcloud/test/compute/fixtures/openstack_v1.1/_servers_detail_ERROR_STATE.json
new file mode 100644
index 0000000..3e41379
--- /dev/null
+++ b/libcloud/test/compute/fixtures/openstack_v1.1/_servers_detail_ERROR_STATE.json
@@ -0,0 +1,66 @@
+{
+ "servers": [
+ {
+ "status": "ERROR",
+ "updated": "2013-12-05T21:07:07Z",
+ "hostId": "2a4a12656a7a57c10188e4ea37f9e09dfb99e3d628f4064f97761e09",
+ "addresses": {
+ "pool": [
+ {
+ "OS-EXT-IPS-MAC:mac_addr": "fa:16:3e:be:f5:87",
+ "version": 4,
+ "addr": "192.168.3.4",
+ "OS-EXT-IPS:type": "fixed"
+ }
+ ]
+ },
+ "links": [
+ {
+ "href": "http://192.168.0.1:8774/v2/dd3eca3de72846948f5d6d975660d325/servers/2d05bd68-3fbb-4b47-9f38-c690a5d93e45",
+ "rel": "self"
+ },
+ {
+ "href": "http://192.168.0.1:8774/dd3eca3de72846948f5d6d975660d325/servers/2d05bd68-3fbb-4b47-9f38-c690a5d93e45",
+ "rel": "bookmark"
+ }
+ ],
+ "key_name": "my_key",
+ "image": "",
+ "OS-EXT-STS:task_state": null,
+ "OS-EXT-STS:vm_state": "error",
+ "OS-SRV-USG:launched_at": null,
+ "flavor": {
+ "id": "4",
+ "links": [
+ {
+ "href": "http://192.168.0.1:8774/dd3eca3de72846948f5d6d975660d325/flavors/4",
+ "rel": "bookmark"
+ }
+ ]
+ },
+ "id": "2d05bd68-3fbb-4b47-9f38-c690a5d93e45",
+ "OS-SRV-USG:terminated_at": null,
+ "OS-EXT-AZ:availability_zone": "nova",
+ "user_id": "a75c583fa46148eaa020d3e88ab53802",
+ "name": "test_vm",
+ "created": "2013-12-02T18:40:36Z",
+ "tenant_id": "dd3eca3de72846948f5d6d975660d325",
+ "OS-DCF:diskConfig": "MANUAL",
+ "os-extended-volumes:volumes_attached": [
+ {
+ "id": "0056485c-ada5-4e44-9905-5b09a18b0139"
+ }
+ ],
+ "accessIPv4": "",
+ "accessIPv6": "",
+ "fault": {
+ "message": "The server has either erred or is incapable of performing the requested operation. (HTTP 500) (Request-ID: req-5ec1e01c-bc04-43e7-957d-c810d4357908)",
+ "code": 500,
+ "created": "2013-12-05T21:07:07Z"
+ },
+ "OS-EXT-STS:power_state": 0,
+ "config_drive": "",
+ "metadata": {}
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/libcloud/blob/df97607e/libcloud/test/compute/test_openstack.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_openstack.py b/libcloud/test/compute/test_openstack.py
index a8f0c3d..b0e1d2c 100644
--- a/libcloud/test/compute/test_openstack.py
+++ b/libcloud/test/compute/test_openstack.py
@@ -850,9 +850,11 @@ class OpenStack_1_1_Tests(unittest.TestCase, TestCaseMixin):
self.driver_klass.connectionCls.conn_classes = (
OpenStack_2_0_MockHttp, OpenStack_2_0_MockHttp)
self.driver_klass.connectionCls.auth_url = "https://auth.api.example.com"
+
OpenStackMockHttp.type = None
OpenStack_1_1_MockHttp.type = None
OpenStack_2_0_MockHttp.type = None
+
self.driver = self.create_driver()
# normally authentication happens lazily, but we force it here
@@ -973,6 +975,14 @@ class OpenStack_1_1_Tests(unittest.TestCase, TestCaseMixin):
self.assertEqual(node.extra['updated'], '2011-10-11T00:50:04Z')
self.assertEqual(node.extra['created'], '2011-10-11T00:51:39Z')
+ def test_list_nodes_no_image_id_attribute(self):
+ # Regression test for LIBCLOD-455
+ self.driver_klass.connectionCls.conn_classes[0].type = 'ERROR_STATE_NO_IMAGE_ID'
+ self.driver_klass.connectionCls.conn_classes[1].type = 'ERROR_STATE_NO_IMAGE_ID'
+
+ nodes = self.driver.list_nodes()
+ self.assertEqual(nodes[0].extra['imageId'], None)
+
def test_list_volumes(self):
volumes = self.driver.list_volumes()
self.assertEqual(len(volumes), 2)
@@ -1501,6 +1511,10 @@ class OpenStack_1_1_MockHttp(MockHttpTestCase):
body = self.fixtures.load('_servers_detail.json')
return (httplib.OK, body, self.json_content_headers, httplib.responses[httplib.OK])
+ def _v1_1_slug_servers_detail_ERROR_STATE_NO_IMAGE_ID(self, method, url, body, headers):
+ body = self.fixtures.load('_servers_detail_ERROR_STATE.json')
+ return (httplib.OK, body, self.json_content_headers, httplib.responses[httplib.OK])
+
def _v1_1_slug_flavors_detail(self, method, url, body, headers):
body = self.fixtures.load('_flavors_detail.json')
return (httplib.OK, body, self.json_content_headers, httplib.responses[httplib.OK])
[2/4] git commit: [LIBCLOUD-455] Don't throw if 'imageId' attribute
is not present in the list_nodes response.
Posted by to...@apache.org.
[LIBCLOUD-455] Don't throw if 'imageId' attribute is not present in the
list_nodes response.
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/991d8f11
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/991d8f11
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/991d8f11
Branch: refs/heads/trunk
Commit: 991d8f113abed61b9a7b06bcdb5d92ac64962d4a
Parents: a59142e
Author: Dustin Spicuzza <du...@virtualroadside.com>
Authored: Thu Dec 5 18:48:49 2013 -0500
Committer: Tomaz Muraus <to...@apache.org>
Committed: Fri Dec 6 18:38:56 2013 +0100
----------------------------------------------------------------------
libcloud/compute/drivers/openstack.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/991d8f11/libcloud/compute/drivers/openstack.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/openstack.py b/libcloud/compute/drivers/openstack.py
index eb6a982..00debd0 100644
--- a/libcloud/compute/drivers/openstack.py
+++ b/libcloud/compute/drivers/openstack.py
@@ -1875,7 +1875,8 @@ class OpenStack_1_1_NodeDriver(OpenStackNodeDriver):
# Docs says "tenantId", but actual is "tenant_id". *sigh*
# Best handle both.
tenantId=api_node.get('tenant_id') or api_node['tenantId'],
- imageId=api_node['image']['id'],
+ # sometimes the image is not set if openstack is in an error state
+ imageId=api_node.get('image', {}).get('id', None),
flavorId=api_node['flavor']['id'],
uri=next(link['href'] for link in api_node['links'] if
link['rel'] == 'self'),