mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-06 07:11:13 +02:00
refactor: ruff autofixes
This commit is contained in:
455 files changed
+12322
-14762
No files matched your search
@@ -38,14 +38,16 @@ class Nat(Cloud):
|
||||
|
||||
allowed_interfaces = Config.instance().settings.Server.allowed_interfaces
|
||||
if allowed_interfaces and isinstance(allowed_interfaces, str):
|
||||
allowed_interfaces = allowed_interfaces.split(',')
|
||||
allowed_interfaces = allowed_interfaces.split(",")
|
||||
if sys.platform.startswith("linux"):
|
||||
nat_interface = Config.instance().settings.Server.default_nat_interface
|
||||
if not nat_interface:
|
||||
nat_interface = "virbr0"
|
||||
if allowed_interfaces and nat_interface not in allowed_interfaces:
|
||||
raise NodeError("NAT interface {} is not allowed be used on this server. "
|
||||
"Please check the server configuration file.".format(nat_interface))
|
||||
raise NodeError(
|
||||
"NAT interface {} is not allowed be used on this server. "
|
||||
"Please check the server configuration file.".format(nat_interface)
|
||||
)
|
||||
if nat_interface not in [interface["name"] for interface in gns3server.utils.interfaces.interfaces()]:
|
||||
raise NodeError(f"NAT interface {nat_interface} is missing, please install libvirt")
|
||||
interface = nat_interface
|
||||
@@ -54,8 +56,10 @@ class Nat(Cloud):
|
||||
if not nat_interface:
|
||||
nat_interface = "vmnet8"
|
||||
if allowed_interfaces and nat_interface not in allowed_interfaces:
|
||||
raise NodeError("NAT interface {} is not allowed be used on this server. "
|
||||
"Please check the server configuration file.".format(nat_interface))
|
||||
raise NodeError(
|
||||
"NAT interface {} is not allowed be used on this server. "
|
||||
"Please check the server configuration file.".format(nat_interface)
|
||||
)
|
||||
interfaces = list(
|
||||
filter(
|
||||
lambda x: nat_interface in x.lower(),
|
||||
|
||||
Reference in new issue
Block a user