Author: tomaz
Date: Fri Mar 30 22:26:22 2012
New Revision: 1307643
URL: http://svn.apache.org/viewvc?rev=1307643&view=rev
Log:
Update create_node in Linode driver and make it return a Node object
instead of a list. This issue has been reported by Jouke Waleson
and is part of LIBCLOUD-175
Modified:
libcloud/trunk/CHANGES
libcloud/trunk/libcloud/compute/drivers/linode.py
libcloud/trunk/test/compute/test_linode.py
Modified: libcloud/trunk/CHANGES
URL:
http://svn.apache.org/viewvc/libcloud/trunk/CHANGES?rev=1307643&r1=1307642&r2=1307643&view=diff
==============================================================================
--- libcloud/trunk/CHANGES (original)
+++ libcloud/trunk/CHANGES Fri Mar 30 22:26:22 2012
@@ -1,5 +1,13 @@
-*- coding: utf-8 -*-
+Changes with Apache Libcloud 0.9.1:
+
+ *) Compute:
+
+ - Update create_node in Linode driver and make it return a Node object
+ instead of a list. Reported by Jouke Waleson. ; LIBCLOUD-175
+ [Tomaz Muraus]
+
Changes with Apache Libcloud 0.9.0:
*) General:
Modified: libcloud/trunk/libcloud/compute/drivers/linode.py
URL:
http://svn.apache.org/viewvc/libcloud/trunk/libcloud/compute/drivers/linode.py?rev=1307643&r1=1307642&r2=1307643&view=diff
==============================================================================
--- libcloud/trunk/libcloud/compute/drivers/linode.py (original)
+++ libcloud/trunk/libcloud/compute/drivers/linode.py Fri Mar 30 22:26:22 2012
@@ -354,7 +354,12 @@ class LinodeNodeDriver(NodeDriver):
# Make a node out of it and hand it back
params = { "api_action": "linode.list", "LinodeID": linode["id"] }
data = self.connection.request(API_ROOT, params=params).objects[0]
- return self._to_nodes(data)
+ nodes = self._to_nodes(data)
+
+ if len(nodes) == 1:
+ return nodes[0]
+
+ return None
def list_sizes(self, location=None):
"""List available Linode plans
Modified: libcloud/trunk/test/compute/test_linode.py
URL:
http://svn.apache.org/viewvc/libcloud/trunk/test/compute/test_linode.py?rev=1307643&r1=1307642&r2=1307643&view=diff
==============================================================================
--- libcloud/trunk/test/compute/test_linode.py (original)
+++ libcloud/trunk/test/compute/test_linode.py Fri Mar 30 22:26:22 2012
@@ -64,11 +64,12 @@ class LinodeTest(unittest.TestCase, Test
def test_create_node_ssh_key_auth(self):
# Will exception on failure
- self.driver.create_node(name="Test",
+ node = self.driver.create_node(name="Test",
location=self.driver.list_locations()[0],
size=self.driver.list_sizes()[0],
image=self.driver.list_images()[6],
auth=NodeAuthSSHKey('foo'))
+ self.assertTrue(isinstance(node, Node))
def test_list_sizes(self):
sizes = self.driver.list_sizes()
@@ -87,7 +88,7 @@ class LinodeTest(unittest.TestCase, Test
size=self.driver.list_sizes()[0],
image=self.driver.list_images()[0],
auth=NodeAuthPassword("foobar"))
- self.assertTrue(isinstance(node[0], Node))
+ self.assertTrue(isinstance(node, Node))
class LinodeMockHttp(MockHttp):