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/15 05:42:46 UTC

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

Author: pquerna
Date: Fri Jan 15 04:42:45 2010
New Revision: 899524

URL: http://svn.apache.org/viewvc?rev=899524&view=rev
Log:
Use the 'slug' instead of order ID as the libcloud node ID for rimuhosting.

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

Modified: incubator/libcloud/trunk/libcloud/drivers/gogrid.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/drivers/gogrid.py?rev=899524&r1=899523&r2=899524&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/drivers/gogrid.py (original)
+++ incubator/libcloud/trunk/libcloud/drivers/gogrid.py Fri Jan 15 04:42:45 2010
@@ -136,7 +136,7 @@
         return element['ip']['ip']
 
     def get_id(self,element):
-        return element.get('id',None)
+        return element['id']
 
     def _to_node(self, element):
         state = self.get_state(element)

Modified: incubator/libcloud/trunk/libcloud/drivers/rimuhosting.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/drivers/rimuhosting.py?rev=899524&r1=899523&r2=899524&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/drivers/rimuhosting.py (original)
+++ incubator/libcloud/trunk/libcloud/drivers/rimuhosting.py Fri Jan 15 04:42:45 2010
@@ -107,18 +107,17 @@
 
     def _order_uri(self, node,resource):
         # Returns the order uri with its resourse appended.
-        return "/orders/%s/%s" % (node.slug,resource)
+        return "/orders/%s/%s" % (node.id,resource)
    
     # TODO: Get the node state.
     def _to_node(self, order):
-        n = Node(id=order['order_oid'],
+        n = Node(id=order['slug'],
                 name=order['domain_name'],
                 state=NodeState.RUNNING,
                 public_ip=[order['allocated_ips']['primary_ip']]+order['allocated_ips']['secondary_ips'],
                 private_ip=[],
-                driver=self.connection.driver
-                )
-        n.slug = order['slug']
+                driver=self.connection.driver,
+                extra={'order_oid': order['order_oid']})
         return n
 
     def _to_size(self,plan):

Modified: incubator/libcloud/trunk/test/test_rimuhosting.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/test/test_rimuhosting.py?rev=899524&r1=899523&r2=899524&view=diff
==============================================================================
--- incubator/libcloud/trunk/test/test_rimuhosting.py (original)
+++ incubator/libcloud/trunk/test/test_rimuhosting.py Fri Jan 15 04:42:45 2010
@@ -33,8 +33,9 @@
         node = nodes[0]
         self.assertEqual(node.public_ip[0], "1.2.3.4")
         self.assertEqual(node.public_ip[1], "1.2.3.5")
-        self.assertEqual(node.id, 88833465)
-    
+        self.assertEqual(node.extra['order_oid'], 88833465)
+        self.assertEqual(node.id, "order-88833465-api-ivan-net-nz")
+
     def test_list_sizes(self):
         sizes = self.driver.list_sizes()
         self.assertEqual(len(sizes),1)