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:34 UTC

svn commit: r894768 - /incubator/libcloud/trunk/libcloud/drivers/linode.py

Author: pquerna
Date: Thu Dec 31 02:31:34 2009
New Revision: 894768

URL: http://svn.apache.org/viewvc?rev=894768&view=rev
Log:
Convert linode create_node to options.

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=894768&r1=894767&r2=894768&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/drivers/linode.py (original)
+++ incubator/libcloud/trunk/libcloud/drivers/linode.py Thu Dec 31 02:31:34 2009
@@ -162,7 +162,7 @@
         self.connection.request(LINODE_ROOT, params=params)
         return True
 
-    def create_node(self, name, image, size, **kwargs):
+    def create_node(self, options, **kwargs):
         # Create
         #
         # Creates a Linode instance.
@@ -202,27 +202,9 @@
         #
         # Please note that for safety, only 5 Linodes can be created per hour.
 
-        # Step -1: Do the datacenter logic
-        fail = LinodeException(0xFC,
-            "Can't pick DC; choose a datacenter with linode_set_datacenter()")
-        if not self.datacenter:
-            # Okay, one has not been chosen.  We need to determine.
-            nodes = self.list_nodes()
-            num = len(nodes)
-            if num == 0:
-                # Won't assume where to deploy the first one.
-                # FIXME: Maybe we should?
-                raise fail
-            else:
-                # One or more nodes, so create the next one there.
-                chosen = nodes[0].extra["DATACENTERID"]
-                for node in nodes[1:]:
-                    # Check to make sure they're all the same
-                    if chosen != node.extra["DATACENTERID"]:
-                        raise fail
-        else:
-            # linode_set_datacenter() was used, cool.
-            chosen = self.datacenter
+        chosen = options.location.id
+        image = options.image
+        size = options.size
 
         # Step 0: Parameter validation before we purchase
         # We're especially careful here so we don't fail after purchase, rather