Skip to content

Commit

Permalink
Use ipAddress and privateIpAddress attribute for the node public and …
Browse files Browse the repository at this point in the history
…private ip

correspondingly,


git-svn-id: https://svn.apache.org/repos/asf/incubator/libcloud/trunk@1071367 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Kami committed Feb 16, 2011
1 parent b424932 commit 9fb15e1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libcloud/drivers/ec2.py
Expand Up @@ -351,8 +351,8 @@ def _to_node(self, element, groups=None):
id=self._findtext(element, 'instanceId'),
name=self._findtext(element, 'instanceId'),
state=state,
public_ip=[self._findtext(element, 'dnsName')],
private_ip=[self._findtext(element, 'privateDnsName')],
public_ip=[self._findtext(element, 'ipAddress')],
private_ip=[self._findtext(element, 'privateIpAddress')],
driver=self.connection.driver,
extra={
'dns_name': self._findattr(element, "dnsName"),
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/ec2/describe_instances.xml
Expand Up @@ -20,6 +20,8 @@
<privateDnsName/>
<dnsName/>
<reason/>
<privateIpAddress>1.2.3.5</privateIpAddress>
<ipAddress>1.2.3.5</ipAddress>
<amiLaunchIndex>0</amiLaunchIndex>
<productCodes/>
<instanceType>m1.small</instanceType>
Expand Down
1 change: 1 addition & 0 deletions test/test_ec2.py
Expand Up @@ -88,6 +88,7 @@ def test_create_node_no_availability_zone(self):
def test_list_nodes(self):
node = self.driver.list_nodes()[0]
self.assertEqual(node.id, 'i-4382922a')
self.assertEqual(len(node.public_ip), 1)

def test_list_location(self):
locations = self.driver.list_locations()
Expand Down

0 comments on commit 9fb15e1

Please sign in to comment.