Updated Branches: refs/heads/trunk d26c9a61e -> 3b8ad8162
Add returning the public ip address of opsrouce nodes when listing nodes Signed-off-by: Tomaz Muraus <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/50a737e6 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/50a737e6 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/50a737e6 Branch: refs/heads/trunk Commit: 50a737e6837fd1e9d2b9d19155a8c3a4c72a3b8a Parents: d26c9a6 Author: Michael <[email protected]> Authored: Sun Aug 25 16:10:20 2013 -0400 Committer: Tomaz Muraus <[email protected]> Committed: Mon Aug 26 14:18:32 2013 +0200 ---------------------------------------------------------------------- libcloud/compute/drivers/opsource.py | 4 +++- ...8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_deployed.xml | 1 + libcloud/test/compute/test_opsource.py | 9 +++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/50a737e6/libcloud/compute/drivers/opsource.py ---------------------------------------------------------------------- diff --git a/libcloud/compute/drivers/opsource.py b/libcloud/compute/drivers/opsource.py index 6ee1432..0b7b57e 100644 --- a/libcloud/compute/drivers/opsource.py +++ b/libcloud/compute/drivers/opsource.py @@ -579,10 +579,12 @@ class OpsourceNodeDriver(NodeDriver): 'status': status, } + public_ip = findtext(element, 'publicIpAddress', SERVER_NS) + n = Node(id=findtext(element, 'id', SERVER_NS), name=findtext(element, 'name', SERVER_NS), state=state, - public_ips=[], + public_ips=[public_ip] if public_ip is not None else [], private_ips=findtext(element, 'privateIpAddress', SERVER_NS), driver=self.connection.driver, extra=extra) http://git-wip-us.apache.org/repos/asf/libcloud/blob/50a737e6/libcloud/test/compute/fixtures/opsource/oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_deployed.xml ---------------------------------------------------------------------- diff --git a/libcloud/test/compute/fixtures/opsource/oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_deployed.xml b/libcloud/test/compute/fixtures/opsource/oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_deployed.xml index ae48208..a11d6c2 100644 --- a/libcloud/test/compute/fixtures/opsource/oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_deployed.xml +++ b/libcloud/test/compute/fixtures/opsource/oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_deployed.xml @@ -17,6 +17,7 @@ <sourceImageId>44ed8b72-ebea-11df-bdc1-001517c46384</sourceImageId> <networkId>53b4c05b-341e-4ac3-b688-bdd78e43ca9e</networkId> <privateIpAddress>10.162.1.1</privateIpAddress> + <publicIpAddress>200.16.132.7</publicIpAddress> <machineName>10-162-1-1</machineName> <isStarted>true</isStarted> <deployedTime>2011-03-02T17:16:09.882Z</deployedTime> http://git-wip-us.apache.org/repos/asf/libcloud/blob/50a737e6/libcloud/test/compute/test_opsource.py ---------------------------------------------------------------------- diff --git a/libcloud/test/compute/test_opsource.py b/libcloud/test/compute/test_opsource.py index c94dba7..f0518c4 100644 --- a/libcloud/test/compute/test_opsource.py +++ b/libcloud/test/compute/test_opsource.py @@ -144,6 +144,15 @@ class OpsourceTests(unittest.TestCase, TestCaseMixin): self.assertEqual(nets[0].name, 'test-net1') self.assertTrue(isinstance(nets[0].location, NodeLocation)) + def test_node_public_ip(self): + nodes = self.driver.list_nodes() + for node in nodes: + if node.id == "abadbc7e-9e10-46ca-9d4a-194bcc6b6c16": + self.assertEqual(node.public_ips[0], '200.16.132.7') + else: + self.assertEqual(len(node.public_ips), 0) + + class OpsourceMockHttp(MockHttp): fixtures = ComputeFileFixtures('opsource')
