mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
add methods for server ipv4 and ipv6 public addresses
This commit is contained in:
parent
8fa6a4561b
commit
e2873afb84
1 changed files with 12 additions and 2 deletions
|
@ -30,8 +30,18 @@ module Fog
|
|||
attribute :ssh_keys
|
||||
|
||||
def public_ip_address
|
||||
if (pub_net = networks['v4'].find { |n| n['type'] == 'public' })
|
||||
pub_net['ip_address']
|
||||
ipv4_address
|
||||
end
|
||||
|
||||
def ipv6_address
|
||||
if (net = networks['v6'].find { |n| n['type'] == 'public' })
|
||||
net['ip_address']
|
||||
end
|
||||
end
|
||||
|
||||
def ipv4_address
|
||||
if (net = networks['v4'].find { |n| n['type'] == 'public' })
|
||||
net['ip_address']
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue