libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r1134090 - in /libcloud/trunk: libcloud/compute/drivers/ec2.py test/compute/fixtures/ec2/describe_instances.xml test/compute/test_ec2.py
Date Thu, 09 Jun 2011 21:30:15 GMT
Author: tomaz
Date: Thu Jun  9 21:30:15 2011
New Revision: 1134090

URL: http://svn.apache.org/viewvc?rev=1134090&view=rev
Log:
Include node tags when calling list_nodes() in EC2 driver.

Changes submitted by Trevor Pounds <trevor dot pounds at gmail dot com> as a
part of LIBCLOUD-89.

Modified:
    libcloud/trunk/libcloud/compute/drivers/ec2.py
    libcloud/trunk/test/compute/fixtures/ec2/describe_instances.xml
    libcloud/trunk/test/compute/test_ec2.py

Modified: libcloud/trunk/libcloud/compute/drivers/ec2.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/compute/drivers/ec2.py?rev=1134090&r1=1134089&r2=1134090&view=diff
==============================================================================
--- libcloud/trunk/libcloud/compute/drivers/ec2.py (original)
+++ libcloud/trunk/libcloud/compute/drivers/ec2.py Thu Jun  9 21:30:15 2011
@@ -339,7 +339,11 @@ class EC2NodeDriver(NodeDriver):
                                       namespace=NAMESPACE),
                 'clienttoken' : findattr(element=element, xpath="clientToken",
                                          namespace=NAMESPACE),
-                'groups': groups
+                'groups': groups,
+                'tags':
+                    dict((findtext(element=item, xpath='key', namespace=NAMESPACE),
+                          findtext(element=item, xpath='value', namespace=NAMESPACE))
+                           for item in findall(element=element, xpath='tagSet/item', namespace=NAMESPACE))
             }
         )
         return n

Modified: libcloud/trunk/test/compute/fixtures/ec2/describe_instances.xml
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/compute/fixtures/ec2/describe_instances.xml?rev=1134090&r1=1134089&r2=1134090&view=diff
==============================================================================
--- libcloud/trunk/test/compute/fixtures/ec2/describe_instances.xml (original)
+++ libcloud/trunk/test/compute/fixtures/ec2/describe_instances.xml Thu Jun  9 21:30:15 2011
@@ -33,6 +33,39 @@
             <state>disabled</state>
           </monitoring>
         </item>
+        <item>
+          <instanceId>i-8474834a</instanceId>
+          <imageId>ami-0f234b234</imageId>
+          <instanceState>
+            <code>0</code>
+            <name>pending</name>
+          </instanceState>
+          <privateDnsName/>
+          <dnsName/>
+          <reason/>
+          <privateIpAddress>1.2.3.5</privateIpAddress>
+          <ipAddress>1.2.3.5</ipAddress>
+          <amiLaunchIndex>0</amiLaunchIndex>
+          <productCodes/>
+          <instanceType>m1.micro</instanceType>
+          <launchTime>2009-08-07T05:47:04.000Z</launchTime>
+          <placement>
+            <availabilityZone>us-west-1a</availabilityZone>
+          </placement>
+          <monitoring>
+            <state>disabled</state>
+          </monitoring>
+          <tagSet>
+            <item>
+              <key>user_key0</key>
+              <value>user_val0</value>
+            </item>
+            <item>
+              <key>user_key1</key>
+              <value>user_val1</value>
+            </item>
+          </tagSet>
+        </item>
       </instancesSet>
     </item>
   </reservationSet>

Modified: libcloud/trunk/test/compute/test_ec2.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/compute/test_ec2.py?rev=1134090&r1=1134089&r2=1134090&view=diff
==============================================================================
--- libcloud/trunk/test/compute/test_ec2.py (original)
+++ libcloud/trunk/test/compute/test_ec2.py Thu Jun  9 21:30:15 2011
@@ -341,6 +341,15 @@ class NimbusTests(EC2Tests):
         self.assertEqual(node.id, 'i-4382922a')
         self.assertEqual(len(node.public_ip), 1)
         self.assertEqual(public_ips[0], '1.2.3.5')
+        self.assertEqual(node.extra['tags'], {})
+
+        node = self.driver.list_nodes()[1]
+        self.assertExecutedMethodCount(0)
+        public_ips = node.public_ip
+        self.assertEqual(node.id, 'i-8474834a')
+        self.assertEqual(len(node.public_ip), 1)
+        self.assertEqual(public_ips[0], '1.2.3.5')
+        self.assertEqual(node.extra['tags'], {'user_key0': 'user_val0', 'user_key1': 'user_val1'})
 
     def test_ex_create_tags(self):
        # Nimbus doesn't support creating tags so this one should be a



Mime
View raw message