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:
parent
ef4726441a
commit
3bbc799748
1 changed files with 11 additions and 1 deletions
|
@ -101,7 +101,12 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
def network_name
|
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
|
end
|
||||||
|
|
||||||
def private_ip_address
|
def private_ip_address
|
||||||
|
@ -290,6 +295,11 @@ module Fog
|
||||||
@password = new_admin_pass
|
@password = new_admin_pass
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_first_network_with_public_ip
|
||||||
|
net = self.addresses.select {|_,v| v.count > 1}
|
||||||
|
net.keys.first
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue