add function to retrieve a network
diff --git a/xos/core/models/instance.py b/xos/core/models/instance.py
index 357e6b3..75826f6 100644
--- a/xos/core/models/instance.py
+++ b/xos/core/models/instance.py
@@ -158,13 +158,17 @@
return ns.ip
return None
- # return an address that the synchronizer can use to SSH to the instance
- def get_ssh_ip(self):
+ # return an address on nat-net
+ def get_network_ip(self, pattern):
for ns in self.ports.all():
- if "nat" in ns.network.name.lower():
+ if pattern in ns.network.name.lower():
return ns.ip
return None
+ # return an address that the synchronizer can use to SSH to the instance
+ def get_ssh_ip(self):
+ return self.get_network_ip("nat")
+
@staticmethod
def select_by_user(user):
if user.is_admin: