mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Improve remote server console host support when binding to 0.0.0.0
Fix https://github.com/GNS3/gns3-gui/issues/1574
This commit is contained in:
8 files changed
+55
-31
No files matched your search
@@ -119,3 +119,18 @@ def test_find_unused_port():
|
||||
def test_find_unused_port_invalid_range():
|
||||
with pytest.raises(aiohttp.web.HTTPConflict):
|
||||
p = PortManager().find_unused_port(10000, 1000)
|
||||
|
||||
|
||||
def test_set_console_host(config):
|
||||
"""
|
||||
If allow remote connection we need to bind console host
|
||||
to 0.0.0.0
|
||||
"""
|
||||
p = PortManager()
|
||||
config.set_section_config("Server", {"allow_remote_console": False})
|
||||
p.console_host = "10.42.1.42"
|
||||
assert p.console_host == "10.42.1.42"
|
||||
p = PortManager()
|
||||
config.set_section_config("Server", {"allow_remote_console": True})
|
||||
p.console_host = "10.42.1.42"
|
||||
assert p.console_host == "0.0.0.0"
|
||||
+4
-3
@@ -145,8 +145,10 @@ def project(tmpdir):
|
||||
@pytest.fixture(scope="function")
|
||||
def port_manager():
|
||||
"""An instance of port manager"""
|
||||
|
||||
return PortManager("127.0.0.1")
|
||||
PortManager._instance = None
|
||||
p = PortManager.instance()
|
||||
p.console_host = "127.0.0.1"
|
||||
return p
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
@@ -198,7 +200,6 @@ def run_around_tests(monkeypatch, port_manager, controller, config):
|
||||
for module in MODULES:
|
||||
module._instance = None
|
||||
|
||||
port_manager._instance = port_manager
|
||||
os.makedirs(os.path.join(tmppath, 'projects'))
|
||||
config.set("Server", "projects_path", os.path.join(tmppath, 'projects'))
|
||||
config.set("Server", "symbols_path", os.path.join(tmppath, 'symbols'))
|
||||
|
||||
@@ -92,7 +92,7 @@ def test_json(node, compute):
|
||||
"name": "demo",
|
||||
"console": node.console,
|
||||
"console_type": node.console_type,
|
||||
"console_host": str(compute.host),
|
||||
"console_host": str(compute.console_host),
|
||||
"command_line": None,
|
||||
"node_directory": None,
|
||||
"properties": node.properties,
|
||||
|
||||
Reference in new issue
Block a user