mirror of
https://github.com/FAUSheppy/athq-vm-management
synced 2025-12-07 14:21:34 +01:00
fix: simple warnings/handlers for ipv6
This commit is contained in:
11
vm.py
11
vm.py
@@ -37,6 +37,8 @@ class VM:
|
|||||||
network = con.networkLookupByName(self.network)
|
network = con.networkLookupByName(self.network)
|
||||||
leases = network.DHCPLeases()
|
leases = network.DHCPLeases()
|
||||||
for l in leases:
|
for l in leases:
|
||||||
|
if not l.get("type") == 0: # FIXME: only ipv4 for now
|
||||||
|
continue
|
||||||
if l.get("hostname") == self.hostname:
|
if l.get("hostname") == self.hostname:
|
||||||
return l
|
return l
|
||||||
|
|
||||||
@@ -92,7 +94,14 @@ class VM:
|
|||||||
components = []
|
components = []
|
||||||
template = self.environment.get_template("nginx_stream_block.conf.j2")
|
template = self.environment.get_template("nginx_stream_block.conf.j2")
|
||||||
if not self.isExternal:
|
if not self.isExternal:
|
||||||
self.sshOutsidePort = 7000 + int(self.ip.split(".")[-1])
|
|
||||||
|
try:
|
||||||
|
self.sshOutsidePort = 7000 + int(self.ip.split(".")[-1])
|
||||||
|
except ValueError as e:
|
||||||
|
print(f"Warning: {self.hostname} Invalid IP (IPv6 is not supported) {e}",
|
||||||
|
file=sys.stderr)
|
||||||
|
return []
|
||||||
|
|
||||||
component = template.render(targetip=self.ip, udp=False,
|
component = template.render(targetip=self.ip, udp=False,
|
||||||
portstring=self.sshOutsidePort,
|
portstring=self.sshOutsidePort,
|
||||||
targetportoverwrite=7000,
|
targetportoverwrite=7000,
|
||||||
|
|||||||
Reference in New Issue
Block a user