You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by je...@apache.org on 2011/01/03 05:21:04 UTC

svn commit: r1054521 - in /incubator/libcloud/trunk: CHANGES libcloud/drivers/ec2.py test/test_ec2.py

Author: jerry
Date: Mon Jan  3 04:21:04 2011
New Revision: 1054521

URL: http://svn.apache.org/viewvc?rev=1054521&view=rev
Log:
EC2 Driver Idempotency capability in create_node; LIBCLOUD-69

Submitted By: David LaBissoniere

Modified:
    incubator/libcloud/trunk/CHANGES
    incubator/libcloud/trunk/libcloud/drivers/ec2.py
    incubator/libcloud/trunk/test/test_ec2.py

Modified: incubator/libcloud/trunk/CHANGES
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/CHANGES?rev=1054521&r1=1054520&r2=1054521&view=diff
==============================================================================
--- incubator/libcloud/trunk/CHANGES (original)
+++ incubator/libcloud/trunk/CHANGES Mon Jan  3 04:21:04 2011
@@ -2,6 +2,9 @@
 
 Changes with Apache Libcloud 0.4.1 [In Development]
 
+    *) EC2 Driver Idempotency capability in create_node; LIBCLOUD-69
+       [David LaBissoniere]
+
     *) SSL Certificate Name Verification:
        - libcloud.security module
        - LibcloudHTTPSConnection, LibcloudHTTPConnection (alias)

Modified: incubator/libcloud/trunk/libcloud/drivers/ec2.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/drivers/ec2.py?rev=1054521&r1=1054520&r2=1054521&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/drivers/ec2.py (original)
+++ incubator/libcloud/trunk/libcloud/drivers/ec2.py Mon Jan  3 04:21:04 2011
@@ -321,6 +321,7 @@ class EC2NodeDriver(NodeDriver):
                                                "placement/availabilityZone"),
                 'kernelid': self._findattr(element, "kernelId"),
                 'ramdiskid': self._findattr(element, "ramdiskId"),
+                'clienttoken' : self._findattr(element, "clientToken"),
                 'groups': groups
             }
         )
@@ -508,6 +509,9 @@ class EC2NodeDriver(NodeDriver):
 
         @keyword    ex_userdata: User data
         @type       ex_userdata: C{str}
+
+        @keyword    ex_clienttoken: Unique identifier to ensure idempotency
+        @type       ex_clienttoken: C{str}
         """
         image = kwargs["image"]
         size = kwargs["size"]
@@ -531,6 +535,9 @@ class EC2NodeDriver(NodeDriver):
         if 'ex_userdata' in kwargs:
             params['UserData'] = base64.b64encode(kwargs['ex_userdata'])
 
+        if 'ex_clienttoken' in kwargs:
+            params['ClientToken'] = kwargs['ex_clienttoken']
+
         object = self.connection.request(self.path, params=params).object
         nodes = self._to_nodes(object, 'instancesSet/item')
 

Modified: incubator/libcloud/trunk/test/test_ec2.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/test/test_ec2.py?rev=1054521&r1=1054520&r2=1054521&view=diff
==============================================================================
--- incubator/libcloud/trunk/test/test_ec2.py (original)
+++ incubator/libcloud/trunk/test/test_ec2.py Mon Jan  3 04:21:04 2011
@@ -40,6 +40,8 @@ class EC2Tests(unittest.TestCase, TestCa
         node = self.driver.create_node(name='foo', image=image, size=size)
         self.assertEqual(node.id, 'i-2ba64342')
 
+    # TODO: add tests for create_node for ex_clienttoken
+
     def test_list_nodes(self):
         node = self.driver.list_nodes()[0]
         self.assertEqual(node.id, 'i-4382922a')