libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anthonys...@apache.org
Subject libcloud git commit: Fix cloudstack tag parsing in Python 3
Date Tue, 14 Jun 2016 23:41:45 GMT
Repository: libcloud
Updated Branches:
  refs/heads/trunk 0d9b28161 -> 6be51b8c1


Fix cloudstack tag parsing in Python 3

Iteritems does not exist in Python 3 and was also not needed here.
Closes #811


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/6be51b8c
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/6be51b8c
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/6be51b8c

Branch: refs/heads/trunk
Commit: 6be51b8c1a56ded34d04bc1a754971d69a14136b
Parents: 0d9b281
Author: Stefan Friesel <stefan.friesel@exoscale.ch>
Authored: Mon Jun 13 15:15:48 2016 +0200
Committer: Anthony Shaw <anthonyshaw@Yus-MacBook-Pro.local>
Committed: Wed Jun 15 09:36:15 2016 +1000

----------------------------------------------------------------------
 libcloud/compute/drivers/cloudstack.py                        | 7 +++----
 .../fixtures/cloudstack/listVirtualMachines_default.json      | 2 +-
 libcloud/test/compute/test_cloudstack.py                      | 2 ++
 3 files changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/6be51b8c/libcloud/compute/drivers/cloudstack.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/cloudstack.py b/libcloud/compute/drivers/cloudstack.py
index 55d1643..85b9a64 100644
--- a/libcloud/compute/drivers/cloudstack.py
+++ b/libcloud/compute/drivers/cloudstack.py
@@ -4721,10 +4721,9 @@ class CloudStackNodeDriver(CloudStackDriverMixIn, NodeDriver):
         tags = {}
 
         for tag in tag_set:
-            for key, value in tag.iteritems():
-                key = tag['key']
-                value = tag['value']
-                tags[key] = value
+            key = tag['key']
+            value = tag['value']
+            tags[key] = value
 
         return tags
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/6be51b8c/libcloud/test/compute/fixtures/cloudstack/listVirtualMachines_default.json
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/cloudstack/listVirtualMachines_default.json b/libcloud/test/compute/fixtures/cloudstack/listVirtualMachines_default.json
index d55c436..38a5817 100644
--- a/libcloud/test/compute/fixtures/cloudstack/listVirtualMachines_default.json
+++ b/libcloud/test/compute/fixtures/cloudstack/listVirtualMachines_default.json
@@ -1 +1 @@
-{ "listvirtualmachinesresponse" : { "virtualmachine" : [  {"id":2600,"name":"test","displayname":"test","account":"fakeaccount","domainid":801,"domain":"AA000062-libcloud-dev","created":"2011-06-23T05:06:42+0000","state":"Running","haenable":false,"zoneid":1,"zonename":"Sydney","templateid":421,"templatename":"XEN
Basic Ubuntu 10.04 Server x64 PV r2.0","templatedisplaytext":"XEN Basic Ubuntu 10.04 Server
x64 PV r2.0","passwordenabled":false,"serviceofferingid":105,"serviceofferingname":"Compute
Micro PRD","cpunumber":1,"cpuspeed":1200,"memory":384,"cpuused":"1.78%","networkkbsread":2,"networkkbswrite":2,"guestosid":12,"rootdeviceid":0,"rootdevicetype":"IscsiLUN","securitygroup":[],"nic":[{"id":3891,"networkid":860,"netmask":"255.255.240.0","gateway":"1.1.2.1","ipaddress":"1.1.1.116","traffictype":"Guest","type":"Virtual","isdefault":true}],"hypervisor":"XenServer"},
{"id":2601,"name":"test","displayname":"test","account":"fakeaccount","domainid":801,"domain":"AA000062-libcloud-dev",
 "created":"2011-06-23T05:09:44+0000","state":"Starting","haenable":false,"zoneid":1,"zonename":"Sydney","templateid":421,"templatename":"XEN
Basic Ubuntu 10.04 Server x64 PV r2.0","templatedisplaytext":"XEN Basic Ubuntu 10.04 Server
x64 PV r2.0","passwordenabled":false,"serviceofferingid":105,"serviceofferingname":"Compute
Micro PRD","cpunumber":1,"cpuspeed":1200,"memory":384,"guestosid":12,"rootdeviceid":0,"rootdevicetype":"IscsiLUN","securitygroup":[],"jobid":17147,"jobstatus":0,"nic":[{"id":3892,"networkid":860,"netmask":"255.255.240.0","gateway":"1.1.2.1","ipaddress":"1.1.1.203","traffictype":"Guest","type":"Virtual","isdefault":true}],"hypervisor":"XenServer"}
] } }
+{ "listvirtualmachinesresponse" : { "virtualmachine" : [  {"id":2600,"name":"test","displayname":"test","account":"fakeaccount","domainid":801,"domain":"AA000062-libcloud-dev","created":"2011-06-23T05:06:42+0000","state":"Running","haenable":false,"zoneid":1,"zonename":"Sydney","templateid":421,"templatename":"XEN
Basic Ubuntu 10.04 Server x64 PV r2.0","templatedisplaytext":"XEN Basic Ubuntu 10.04 Server
x64 PV r2.0","passwordenabled":false,"serviceofferingid":105,"serviceofferingname":"Compute
Micro PRD","cpunumber":1,"cpuspeed":1200,"memory":384,"cpuused":"1.78%","networkkbsread":2,"networkkbswrite":2,"guestosid":12,"rootdeviceid":0,"rootdevicetype":"IscsiLUN","securitygroup":[],"nic":[{"id":3891,"networkid":860,"netmask":"255.255.240.0","gateway":"1.1.2.1","ipaddress":"1.1.1.116","traffictype":"Guest","type":"Virtual","isdefault":true}],"hypervisor":"XenServer",
"tags": [{"key": "testkey", "value": "testvalue"}, {"key": "foo", "value": "bar"}]}, {"id":2601,"name":"test","displayn
 ame":"test","account":"fakeaccount","domainid":801,"domain":"AA000062-libcloud-dev","created":"2011-06-23T05:09:44+0000","state":"Starting","haenable":false,"zoneid":1,"zonename":"Sydney","templateid":421,"templatename":"XEN
Basic Ubuntu 10.04 Server x64 PV r2.0","templatedisplaytext":"XEN Basic Ubuntu 10.04 Server
x64 PV r2.0","passwordenabled":false,"serviceofferingid":105,"serviceofferingname":"Compute
Micro PRD","cpunumber":1,"cpuspeed":1200,"memory":384,"guestosid":12,"rootdeviceid":0,"rootdevicetype":"IscsiLUN","securitygroup":[],"jobid":17147,"jobstatus":0,"nic":[{"id":3892,"networkid":860,"netmask":"255.255.240.0","gateway":"1.1.2.1","ipaddress":"1.1.1.203","traffictype":"Guest","type":"Virtual","isdefault":true}],"hypervisor":"XenServer"}
] } }

http://git-wip-us.apache.org/repos/asf/libcloud/blob/6be51b8c/libcloud/test/compute/test_cloudstack.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_cloudstack.py b/libcloud/test/compute/test_cloudstack.py
index fdc3f45..12449e3 100644
--- a/libcloud/test/compute/test_cloudstack.py
+++ b/libcloud/test/compute/test_cloudstack.py
@@ -619,6 +619,8 @@ class CloudStackCommonTestCase(TestCaseMixin):
         self.assertEqual(1, len(nodes[0].extra['port_forwarding_rules']))
         self.assertEqual('bc7ea3ee-a2c3-4b86-a53f-01bdaa1b2e32',
                          nodes[0].extra['port_forwarding_rules'][0].id)
+        self.assertEqual({"testkey": "testvalue", "foo": "bar"},
+                         nodes[0].extra['tags'])
 
     def test_list_nodes_location_filter(self):
         def list_nodes_mock(self, **kwargs):


Mime
View raw message