libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r1484194 - in /libcloud/trunk: CHANGES libcloud/compute/drivers/ec2.py libcloud/test/compute/test_ec2.py
Date Sat, 18 May 2013 22:40:42 GMT
Author: tomaz
Date: Sat May 18 22:40:42 2013
New Revision: 1484194

URL: http://svn.apache.org/r1484194
Log:
For consistency rename "ex_describe_keypairs" method to "ex_describe_keypair".

Also modify "ex_describe_keypair" method to return key fingerprint in the return
value.

Part of LIBCLOUD-326.

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

Modified: libcloud/trunk/CHANGES
URL: http://svn.apache.org/viewvc/libcloud/trunk/CHANGES?rev=1484194&r1=1484193&r2=1484194&view=diff
==============================================================================
--- libcloud/trunk/CHANGES (original)
+++ libcloud/trunk/CHANGES Sat May 18 22:40:42 2013
@@ -37,6 +37,14 @@ Changes with Apache Libcloud in deveplom
       a number of virtual CPUs for this size. (LIBCLOUD-325)
       [Carlo]
 
+    - For consistency rename "ex_describe_keypairs" method in the EC2 driver to
+      "ex_describe_keypair".
+      [Tomaz Muraus]
+
+    - Modify "ex_describe_keypair" method to return key fingerprint in the
+      return value. (LIBCLOUD-326)
+      [Andre Merzky, Tomaz Muraus]
+
  *) Load Balancer
 
     - Add ex_list_current_usage method to the Rackspace driver.

Modified: libcloud/trunk/libcloud/compute/drivers/ec2.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/compute/drivers/ec2.py?rev=1484194&r1=1484193&r2=1484194&view=diff
==============================================================================
--- libcloud/trunk/libcloud/compute/drivers/ec2.py (original)
+++ libcloud/trunk/libcloud/compute/drivers/ec2.py Sat May 18 22:40:42 2013
@@ -800,7 +800,14 @@ class BaseEC2NodeDriver(NodeDriver):
         return names
 
     def ex_describe_keypairs(self, name):
-        """Describes a keypair by name
+        """
+        Here for backward compatibility.
+        """
+        return self.ex_describe_keypair(name=name)
+
+    def ex_describe_keypair(self, name):
+        """
+        Describes a keypair by name.
 
         @note: This is a non-standard extension API, and only works for EC2.
 
@@ -818,8 +825,12 @@ class BaseEC2NodeDriver(NodeDriver):
         response = self.connection.request(self.path, params=params).object
         key_name = findattr(element=response, xpath='keySet/item/keyName',
                             namespace=NAMESPACE)
+        fingerprint = findattr(element=response,
+                               xpath='keySet/item/keyFingerprint',
+                               namespace=NAMESPACE).strip()
         return {
-            'keyName': key_name
+            'keyName': key_name,
+            'keyFingerprint': fingerprint
         }
 
     def ex_list_security_groups(self):

Modified: libcloud/trunk/libcloud/test/compute/test_ec2.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/test/compute/test_ec2.py?rev=1484194&r1=1484193&r2=1484194&view=diff
==============================================================================
--- libcloud/trunk/libcloud/test/compute/test_ec2.py (original)
+++ libcloud/trunk/libcloud/test/compute/test_ec2.py Sat May 18 22:40:42 2013
@@ -288,6 +288,20 @@ class EC2Tests(LibcloudTestCase, TestCas
         keys = self.driver.ex_describe_all_keypairs()
         self.assertEqual(keys, ['gsg-keypair'])
 
+    def test_ex_describe_keypairs(self):
+        keypair1 = self.driver.ex_describe_keypair('gsg-keypair')
+
+        # Test backward compatibility
+        keypair2 = self.driver.ex_describe_keypairs('gsg-keypair')
+
+        fingerprint = '00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:' + \
+                      '00:00:00:00:00'
+
+        self.assertEqual(keypair1['keyName'], 'gsg-keypair')
+        self.assertEqual(keypair1['keyFingerprint'], fingerprint)
+        self.assertEqual(keypair2['keyName'], 'gsg-keypair')
+        self.assertEqual(keypair2['keyFingerprint'], fingerprint)
+
     def test_ex_describe_tags(self):
         node = Node('i-4382922a', None, None, None, None, self.driver)
         tags = self.driver.ex_describe_tags(resource=node)



Mime
View raw message