You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by or...@apache.org on 2010/03/30 03:19:56 UTC

svn commit: r928956 - in /incubator/libcloud/trunk: libcloud/drivers/slicehost.py test/test_slicehost.py

Author: oremj
Date: Tue Mar 30 01:19:56 2010
New Revision: 928956

URL: http://svn.apache.org/viewvc?rev=928956&view=rev
Log:
Slicehost: add generates_password

Modified:
    incubator/libcloud/trunk/libcloud/drivers/slicehost.py
    incubator/libcloud/trunk/test/test_slicehost.py

Modified: incubator/libcloud/trunk/libcloud/drivers/slicehost.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/drivers/slicehost.py?rev=928956&r1=928955&r2=928956&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/drivers/slicehost.py (original)
+++ incubator/libcloud/trunk/libcloud/drivers/slicehost.py Tue Mar 30 01:19:56 2010
@@ -59,6 +59,8 @@ class SlicehostNodeDriver(NodeDriver):
     type = Provider.SLICEHOST
     name = 'Slicehost'
 
+    features = {"create_node": ["generates_password"]}
+
     NODE_STATE_MAP = { 'active': NodeState.RUNNING,
                        'build': NodeState.PENDING,
                        'reboot': NodeState.REBOOTING,
@@ -145,7 +147,7 @@ class SlicehostNodeDriver(NodeDriver):
     def _to_node(self, element):
 
         attrs = [ 'name', 'image-id', 'progress', 'id', 'bw-out', 'bw-in', 
-                  'flavor-id', 'status', 'ip-address' ]
+                  'flavor-id', 'status', 'ip-address', 'root-password' ]
 
         node_attrs = {}
         for attr in attrs:
@@ -177,7 +179,10 @@ class SlicehostNodeDriver(NodeDriver):
                  state=state,
                  public_ip=[public_ip],
                  private_ip=[private_ip],
-                 driver=self.connection.driver)
+                 driver=self.connection.driver,
+                 extra={
+                     'password': element.findtext('root-password'),
+                 })
         return n
 
     def _to_sizes(self, object):

Modified: incubator/libcloud/trunk/test/test_slicehost.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/test/test_slicehost.py?rev=928956&r1=928955&r2=928956&view=diff
==============================================================================
--- incubator/libcloud/trunk/test/test_slicehost.py (original)
+++ incubator/libcloud/trunk/test/test_slicehost.py Tue Mar 30 01:19:56 2010
@@ -97,6 +97,7 @@ class SlicehostTest(unittest.TestCase, T
         size = NodeSize(1, '256 slice', None, None, None, None, driver=self.driver)
         node = self.driver.create_node(name='slicetest', image=image, size=size)
         self.assertEqual(node.name, 'slicetest')
+        self.assertEqual(node.extra.get('password'), 'fooadfa1231')
 
 class SlicehostMockHttp(MockHttp):