Digitalocean public private ip (#27269)
* When using private networking the ip_address key contains the private ip. Add the following info to module output when available: - private_ipv4_address - public_ipv4_address - private_ipv6_address - public_ipv6_address
This commit is contained in:
parent
c6f397b160
commit
4094ba7682
1 changed files with 6 additions and 0 deletions
|
@ -232,6 +232,12 @@ class Droplet(JsonfyMixIn):
|
|||
if attrs:
|
||||
for k, v in attrs.items():
|
||||
setattr(self, k, v)
|
||||
networks = attrs.get('networks', {})
|
||||
for network in networks.get('v6', []):
|
||||
if network['type'] == 'public':
|
||||
setattr(self, 'public_ipv6_address', network['ip_address'])
|
||||
else:
|
||||
setattr(self, 'private_ipv6_address', network['ip_address'])
|
||||
else:
|
||||
json = self.manager.show_droplet(self.id)
|
||||
if json['ip_address']:
|
||||
|
|
Loading…
Reference in a new issue