Author: tomaz
Date: Fri Jan 6 06:10:39 2012
New Revision: 1227972
URL: http://svn.apache.org/viewvc?rev=1227972&view=rev
Log:
Actually fix the hexlify problem in the Linode driver and add a test case for
it.
Modified:
libcloud/trunk/libcloud/compute/drivers/linode.py
libcloud/trunk/test/compute/test_linode.py
Modified: libcloud/trunk/libcloud/compute/drivers/linode.py
URL:
http://svn.apache.org/viewvc/libcloud/trunk/libcloud/compute/drivers/linode.py?rev=1227972&r1=1227971&r2=1227972&view=diff
==============================================================================
--- libcloud/trunk/libcloud/compute/drivers/linode.py (original)
+++ libcloud/trunk/libcloud/compute/drivers/linode.py Fri Jan 6 06:10:39 2012
@@ -27,6 +27,8 @@ Linode(R) is a registered trademark of L
"""
+import os
+
try:
import simplejson as json
except ImportError:
@@ -300,7 +302,8 @@ class LinodeNodeDriver(NodeDriver):
# Step 2: linode.disk.createfromdistribution
if not root:
- root = u(binascii.hexlify(os.urandom(8).encode('hex')))
+ root = binascii.hexlify(os.urandom(8)).decode('ascii')
+
params = {
"api_action": "linode.disk.createfromdistribution",
"LinodeID": linode["id"],
Modified: libcloud/trunk/test/compute/test_linode.py
URL:
http://svn.apache.org/viewvc/libcloud/trunk/test/compute/test_linode.py?rev=1227972&r1=1227971&r2=1227972&view=diff
==============================================================================
--- libcloud/trunk/test/compute/test_linode.py (original)
+++ libcloud/trunk/test/compute/test_linode.py Fri Jan 6 06:10:39 2012
@@ -22,7 +22,7 @@ import unittest
from libcloud.utils.py3 import httplib
from libcloud.compute.drivers.linode import LinodeNodeDriver
-from libcloud.compute.base import Node, NodeAuthPassword
+from libcloud.compute.base import Node, NodeAuthPassword, NodeAuthSSHKey
from test import MockHttp
from test.compute import TestCaseMixin
@@ -54,7 +54,7 @@ class LinodeTest(unittest.TestCase, Test
node = self.driver.list_nodes()[0]
self.driver.destroy_node(node)
- def test_create_node(self):
+ def test_create_node_password_auth(self):
# Will exception on failure
self.driver.create_node(name="Test",
location=self.driver.list_locations()[0],
@@ -62,6 +62,14 @@ class LinodeTest(unittest.TestCase, Test
image=self.driver.list_images()[6],
auth=NodeAuthPassword("test123"))
+ def test_create_node_ssh_key_auth(self):
+ # Will exception on failure
+ 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'))
+
def test_list_sizes(self):
sizes = self.driver.list_sizes()
self.assertEqual(len(sizes), 10)