mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-28 11:18:11 +00:00
Fix tests.
This commit is contained in:
parent
aaf59e6050
commit
b7e436efdf
@ -21,6 +21,7 @@ from .cloud import Cloud
|
||||
from ...error import NodeError
|
||||
|
||||
import gns3server.utils.interfaces
|
||||
from gns3server.config import Config
|
||||
|
||||
import logging
|
||||
log = logging.getLogger(__name__)
|
||||
@ -35,12 +36,12 @@ class Nat(Cloud):
|
||||
def __init__(self, name, node_id, project, manager, ports=None):
|
||||
|
||||
if sys.platform.startswith("linux"):
|
||||
nat_interface = manager.config.get_section_config("Server").get("nat_interface", "virbr0")
|
||||
nat_interface = Config.instance().get_section_config("Server").get("nat_interface", "virbr0")
|
||||
if nat_interface not in [interface["name"] for interface in gns3server.utils.interfaces.interfaces()]:
|
||||
raise NodeError("NAT interface {} is missing, please install libvirt".format(nat_interface))
|
||||
interface = nat_interface
|
||||
else:
|
||||
nat_interface = manager.config.get_section_config("Server").get("nat_interface", "vmnet8")
|
||||
nat_interface = Config.instance().get_section_config("Server").get("nat_interface", "vmnet8")
|
||||
interfaces = list(filter(lambda x: nat_interface in x.lower(),
|
||||
[interface["name"] for interface in gns3server.utils.interfaces.interfaces()]))
|
||||
if not len(interfaces):
|
||||
|
Loading…
Reference in New Issue
Block a user