mirror of
https://github.com/dkmstr/openuds.git
synced 2025-01-13 13:17:54 +03:00
Fixed types for proxmox (network)
This commit is contained in:
parent
5df07875f9
commit
d9a948df38
@ -2,7 +2,7 @@ import datetime
|
|||||||
import re
|
import re
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
networkRe = re.compile(r'([a-zA-Z0-9]+)=([^,]+)(,bridge=([^,]*),firewall=([^,]*))?') # May have vla id at end
|
networkRe = re.compile(r'([a-zA-Z0-9]+)=([^,]+)') # May have vla id at end
|
||||||
|
|
||||||
# Conversor from dictionary to NamedTuple
|
# Conversor from dictionary to NamedTuple
|
||||||
conversors: typing.MutableMapping[typing.Type, typing.Callable] = {
|
conversors: typing.MutableMapping[typing.Type, typing.Callable] = {
|
||||||
@ -136,19 +136,15 @@ class TaskStatus(typing.NamedTuple):
|
|||||||
class NetworkConfiguration(typing.NamedTuple):
|
class NetworkConfiguration(typing.NamedTuple):
|
||||||
type: str
|
type: str
|
||||||
mac: str
|
mac: str
|
||||||
bridge: str
|
|
||||||
firewall: bool
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def fromString(value: str) -> 'NetworkConfiguration':
|
def fromString(value: str) -> 'NetworkConfiguration':
|
||||||
v = networkRe.match(value)
|
v = networkRe.match(value)
|
||||||
type = mac = bridge = firewall = ''
|
type = mac = ''
|
||||||
if v:
|
if v:
|
||||||
type, mac = v.group(1), v.group(2)
|
type, mac = v.group(1), v.group(2)
|
||||||
bridge = v.group(4) or ''
|
|
||||||
firewall = v.group(5)
|
|
||||||
|
|
||||||
return NetworkConfiguration(type=type, mac=mac, bridge=bridge, firewall=bool(int(firewall)))
|
return NetworkConfiguration(type=type, mac=mac)
|
||||||
|
|
||||||
|
|
||||||
class VMInfo(typing.NamedTuple):
|
class VMInfo(typing.NamedTuple):
|
||||||
|
Loading…
Reference in New Issue
Block a user