libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r1310662 - in /libcloud/trunk: CHANGES libcloud/compute/drivers/openstack.py test/compute/fixtures/openstack_v1.1/_servers_26f7fbee_8ce1_4c28_887a_bfe8e4bb10fe.json test/compute/test_openstack.py
Date Sat, 07 Apr 2012 02:40:16 GMT
Author: tomaz
Date: Sat Apr  7 02:40:16 2012
New Revision: 1310662

URL: http://svn.apache.org/viewvc?rev=1310662&view=rev
Log:
Add 'ex_keyname' argument to the create_node method in the OpenStack
driver. This patch has been contributed by Jay Doane and is part of
LIBCLOUD-177.

Modified:
    libcloud/trunk/CHANGES
    libcloud/trunk/libcloud/compute/drivers/openstack.py
    libcloud/trunk/test/compute/fixtures/openstack_v1.1/_servers_26f7fbee_8ce1_4c28_887a_bfe8e4bb10fe.json
    libcloud/trunk/test/compute/test_openstack.py

Modified: libcloud/trunk/CHANGES
URL: http://svn.apache.org/viewvc/libcloud/trunk/CHANGES?rev=1310662&r1=1310661&r2=1310662&view=diff
==============================================================================
--- libcloud/trunk/CHANGES (original)
+++ libcloud/trunk/CHANGES Sat Apr  7 02:40:16 2012
@@ -1,5 +1,13 @@
                                    -*- coding: utf-8 -*-
 
+Changes with Apache Libcloud in development:
+
+  *) Compute:
+
+    - Add 'ex_keyname' argument to the create_node method in the OpenStack
+      driver.
+      [Jay Doane]
+
 Changes with Apache Libcloud 0.9.1:
 
   *) General:

Modified: libcloud/trunk/libcloud/compute/drivers/openstack.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/compute/drivers/openstack.py?rev=1310662&r1=1310661&r2=1310662&view=diff
==============================================================================
--- libcloud/trunk/libcloud/compute/drivers/openstack.py (original)
+++ libcloud/trunk/libcloud/compute/drivers/openstack.py Sat Apr  7 02:40:16 2012
@@ -806,6 +806,10 @@ class OpenStack_1_1_NodeDriver(OpenStack
         @keyword    ex_files:   File Path => File contents to create on
                                 the node
         @type       ex_files:   C{dict}
+
+        @keyword    ex_keyname:  Name of existing public key to inject into instance
+        @type       ex_keyname:  C{string}
+
         """
 
         server_params = self._create_args_to_params(None, **kwargs)
@@ -864,6 +868,9 @@ class OpenStack_1_1_NodeDriver(OpenStack
                                                                  {}))
         }
 
+        if 'ex_keyname' in kwargs:
+            server_params['key_name'] = kwargs['ex_keyname']
+
         if 'name' in kwargs:
             server_params['name'] = kwargs.get('name')
         else:
@@ -1047,6 +1054,7 @@ class OpenStack_1_1_NodeDriver(OpenStack
                 password=api_node.get('adminPass'),
                 created=api_node['created'],
                 updated=api_node['updated'],
+                key_name=api_node.get('key_name', None),
             ),
         )
 

Modified: libcloud/trunk/test/compute/fixtures/openstack_v1.1/_servers_26f7fbee_8ce1_4c28_887a_bfe8e4bb10fe.json
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/compute/fixtures/openstack_v1.1/_servers_26f7fbee_8ce1_4c28_887a_bfe8e4bb10fe.json?rev=1310662&r1=1310661&r2=1310662&view=diff
==============================================================================
--- libcloud/trunk/test/compute/fixtures/openstack_v1.1/_servers_26f7fbee_8ce1_4c28_887a_bfe8e4bb10fe.json
(original)
+++ libcloud/trunk/test/compute/fixtures/openstack_v1.1/_servers_26f7fbee_8ce1_4c28_887a_bfe8e4bb10fe.json
Sat Apr  7 02:40:16 2012
@@ -29,7 +29,7 @@
         "addresses": {},
         "accessIPv4": "",
         "accessIPv6": "",
-        "key_name": "",
+        "key_name": "devstack",
         "progress": null,
         "flavor": {
             "id": "1",

Modified: libcloud/trunk/test/compute/test_openstack.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/compute/test_openstack.py?rev=1310662&r1=1310661&r2=1310662&view=diff
==============================================================================
--- libcloud/trunk/test/compute/test_openstack.py (original)
+++ libcloud/trunk/test/compute/test_openstack.py Sat Apr  7 02:40:16 2012
@@ -673,6 +673,17 @@ class OpenStack_1_1_Tests(unittest.TestC
         self.assertEqual(node.extra['password'], 'racktestvJq7d3')
         self.assertEqual(node.extra['metadata']['My Server Name'], 'Apache1')
 
+    def test_create_node_with_ex_keyname(self):
+        image = NodeImage(id=11, name='Ubuntu 8.10 (intrepid)', driver=self.driver)
+        size = NodeSize(1, '256 slice', None, None, None, None, driver=self.driver)
+        node = self.driver.create_node(name='racktest', image=image, size=size,
+                                       ex_keyname='devstack')
+        self.assertEqual(node.id, '26f7fbee-8ce1-4c28-887a-bfe8e4bb10fe')
+        self.assertEqual(node.name, 'racktest')
+        self.assertEqual(node.extra['password'], 'racktestvJq7d3')
+        self.assertEqual(node.extra['metadata']['My Server Name'], 'Apache1')
+        self.assertEqual(node.extra['key_name'], 'devstack')
+
     def test_destroy_node(self):
         self.assertTrue(self.node.destroy())
 



Mime
View raw message