refactor: ruff autofixes

This commit is contained in:
Mark Paronyan committed 2026-09-27 15:55:10 +03:00
1 parent 2ac637c662
commit a0450b6bce
455 files changed
+12322 -14762

No files matched your search

+9 -5
View File
@@ -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(),