Merge pull request #6992 from joefiorini/patch-1
Support hosts without private ip without errors
This commit is contained in:
commit
040600f4f7
1 changed files with 5 additions and 1 deletions
|
@ -279,7 +279,11 @@ class LinodeInventory(object):
|
||||||
|
|
||||||
node_vars["datacenter_city"] = self.get_datacenter_city(node)
|
node_vars["datacenter_city"] = self.get_datacenter_city(node)
|
||||||
node_vars["public_ip"] = [addr.address for addr in node.ipaddresses if addr.is_public][0]
|
node_vars["public_ip"] = [addr.address for addr in node.ipaddresses if addr.is_public][0]
|
||||||
node_vars["private_ip"] = [addr.address for addr in node.ipaddresses if not addr.is_public][0]
|
|
||||||
|
private_ips = [addr.address for addr in node.ipaddresses if not addr.is_public]
|
||||||
|
|
||||||
|
if private_ips:
|
||||||
|
node_vars["private_ip"] = private_ips[0]
|
||||||
|
|
||||||
return self.json_format_dict(node_vars, True)
|
return self.json_format_dict(node_vars, True)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue