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

Add a helper method for network_names. Also, update network_name methdo to set itself to the first network with a public ip address by default.

This commit is contained in:
Rupak Ganguly 2013-05-30 15:39:29 -04:00
parent ef4726441a
commit 3bbc799748

View file

@ -101,7 +101,12 @@ module Fog
end
def network_name
@network_name ||= 'hpcloud'
@network_name ||= get_first_network_with_public_ip
end
# derive the network names from the addresses hash
def network_names
self.addresses.keys unless self.addresses.nil?
end
def private_ip_address
@ -290,6 +295,11 @@ module Fog
@password = new_admin_pass
end
def get_first_network_with_public_ip
net = self.addresses.select {|_,v| v.count > 1}
net.keys.first
end
end
end