libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pque...@apache.org
Subject svn commit: r894770 - /incubator/libcloud/trunk/libcloud/drivers/linode.py
Date Thu, 31 Dec 2009 02:31:42 GMT
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:



Mime
View raw message