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 2010/01/05 01:23:48 UTC

svn commit: r895836 - in /incubator/libcloud/trunk: libcloud/drivers/rimuhosting.py test/test_rimuhosting.py

Author: pquerna
Date: Tue Jan  5 00:23:48 2010
New Revision: 895836

URL: http://svn.apache.org/viewvc?rev=895836&view=rev
Log:
Update rimuhosting driver for updated create_node

Modified:
    incubator/libcloud/trunk/libcloud/drivers/rimuhosting.py
    incubator/libcloud/trunk/test/test_rimuhosting.py

Modified: incubator/libcloud/trunk/libcloud/drivers/rimuhosting.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/drivers/rimuhosting.py?rev=895836&r1=895835&r2=895836&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/drivers/rimuhosting.py (original)
+++ incubator/libcloud/trunk/libcloud/drivers/rimuhosting.py Tue Jan  5 00:23:48 2010
@@ -163,7 +163,7 @@
         # XXX check that the response was actually successful
         return True
 
-    def create_node(self, name, image, size, **kwargs):
+    def create_node(self, **kwargs):
         # Creates a RimuHosting instance
         #
         #   name    Must be a FQDN. e.g example.com.
@@ -186,10 +186,13 @@
         #   pricing_plan_code       Plan from list_sizes
         #   
         #   control_panel       Control panel to install on the VPS.
-        #   password            Password to set on the VPS.
         #
         #
         # Note we don't do much error checking in this because we the API to error out if there is a problem.  
+        name = kwargs['name']
+        image = kwargs['image']
+        size = kwargs['size']
+
         data = {
             'instantiation_options':{'domain_name': name, 'distro': image.id},
             'pricing_plan_code': size.id,
@@ -199,7 +202,12 @@
             data['instantiation_options']['control_panel'] = kwargs['control_panel']
         
 
-        if kwargs.has_key('password'):
+        if kwargs.has_key('auth'):
+            auth = kwargs['auth']
+            if isinstance(auth, NodeAuthPassword):
+                password = auth.password
+            else:
+                raise ValueError('auth must be of NodeAuthPassword type')
             data['instantiation_options']['password'] = kwargs['password']
         
         if kwargs.has_key('billing_oid'):

Modified: incubator/libcloud/trunk/test/test_rimuhosting.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/test/test_rimuhosting.py?rev=895836&r1=895835&r2=895836&view=diff
==============================================================================
--- incubator/libcloud/trunk/test/test_rimuhosting.py (original)
+++ incubator/libcloud/trunk/test/test_rimuhosting.py Tue Jan  5 00:23:48 2010
@@ -66,7 +66,7 @@
         # Raises exception on failure
         size = self.driver.list_sizes()[0]
         image = self.driver.list_images()[0]
-        self.driver.create_node("api.ivan.net.nz",image, size)
+        self.driver.create_node(name="api.ivan.net.nz", image=image, size=size)
 
 class RimuHostingMockHttp(MockHttp):
     def _r_orders(self,method,url,body,headers):