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

changes to make old ips work better and activate network for HP

This commit is contained in:
Terry Howe 2013-10-07 14:42:30 -06:00 committed by Rupak Ganguly
parent c1e60efcbd
commit 9025db5df6

View file

@ -100,9 +100,18 @@ module Fog
@network_name ||= "private" @network_name ||= "private"
end end
def private_ip_addresses
return nil if addresses.nil?
addr = []
addresses.each { |key, value|
ipaddr = value.first
addr << ipaddr["addr"] unless ipaddr.nil?
}
addr
end
def private_ip_address def private_ip_address
addr = addresses.nil? ? nil : addresses.fetch(network_name, []).first private_ip_addresses.first
addr["addr"] if addr
end end
def private_key_path def private_key_path
@ -114,20 +123,23 @@ module Fog
@private_key ||= private_key_path && File.read(private_key_path) @private_key ||= private_key_path && File.read(private_key_path)
end end
def public_ip_address def public_ip_addresses
# FIX: Both the private and public ips are bundled under "private" network name return nil if addresses.nil?
# So hack to get to the public ip address addr = []
if !addresses.nil? addresses.each { |key, value|
addr = addresses.fetch(network_name, []) if value.count > 1
# if we have more than 1 address, then the return the second address which is public value = value.dup
if addr.count > 1 value.delete_at(0)
addr[1]["addr"] value.each { |ipaddr|
else addr << ipaddr["addr"]
nil }
end end
else }
nil addr
end end
def public_ip_address
public_ip_addresses.first
end end
def public_key_path def public_key_path