1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Update public_ip_address method to return first public ip address.

This commit is contained in:
Rupak Ganguly 2012-02-22 03:35:56 -05:00
parent 415e05b2d7
commit 12232eccfa

View file

@ -79,9 +79,17 @@ module Fog
def public_ip_address
# FIX: Both the private and public ips are bundled under "private" network name
# So hack to get to the public ip address
#addr = addresses.nil? ? nil : addresses.fetch('public', []).first
addr = addresses.nil? ? nil : addresses.fetch('private', []).last
addr["addr"] if addr
if !addresses.nil?
addr = addresses.fetch('private', [])
# if we have more than 1 address, then the return the second address which is public
if addr.count > 1
addr[1]["addr"]
else
nil
end
else
nil
end
end
def public_key_path