You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by pq...@apache.org on 2009/12/31 03:31:42 UTC
svn commit: r894770 - /incubator/libcloud/trunk/libcloud/drivers/linode.py
Author: pquerna
Date: Thu Dec 31 02:31:42 2009
New Revision: 894770
URL: http://svn.apache.org/viewvc?rev=894770&view=rev
Log:
Update linode driver to use authentication classes
Modified:
incubator/libcloud/trunk/libcloud/drivers/linode.py
Modified: incubator/libcloud/trunk/libcloud/drivers/linode.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/drivers/linode.py?rev=894770&r1=894769&r2=894770&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/drivers/linode.py (original)
+++ incubator/libcloud/trunk/libcloud/drivers/linode.py Thu Dec 31 02:31:42 2009
@@ -22,7 +22,9 @@
#
from libcloud.types import Provider, NodeState
-from libcloud.base import ConnectionKey, Response, NodeDriver, NodeSize, Node, NodeLocation
+from libcloud.base import ConnectionKey, Response
+from libcloud.base import NodeDriver, NodeSize, Node, NodeLocation
+from libcloud.base import NodeAuthPassword, NodeAuthSSHKey
from libcloud.base import NodeImage
from copy import copy
@@ -162,7 +164,7 @@
self.connection.request(LINODE_ROOT, params=params)
return True
- def create_node(self, options, **kwargs):
+ def create_node(self, name, options, **kwargs):
# Create
#
# Creates a Linode instance.
@@ -220,9 +222,14 @@
if payment not in ["1", "12", "24"]:
raise LinodeException(0xFB, "Invalid subscription (1, 12, 24)")
+ ssh = None
+ root = None
# SSH key and/or root password
- ssh = None if "ssh" not in kwargs else kwargs["ssh"]
- root = None if "root" not in kwargs else kwargs["root"]
+ if isinstance(options.auth, NodeAuthSSHKey):
+ ssh = options.auth.pubkey
+ elif isinstance(options.auth, NodeAuthPassword):
+ root = options.auth.password
+
if not ssh and not root:
raise LinodeException(0xFB, "Need SSH key or root password")
if len(root) < 6: