mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 14:01: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
@@ -57,12 +57,16 @@ class Controller:
|
||||
yield from self.load()
|
||||
server_config = Config.instance().get_section_config("Server")
|
||||
host = server_config.get("host", "localhost")
|
||||
# If console_host is 0.0.0.0 client will use the ip they use
|
||||
# to connect to the controller
|
||||
console_host = host
|
||||
if host == "0.0.0.0":
|
||||
host = "127.0.0.1"
|
||||
yield from self.add_compute(compute_id="local",
|
||||
name=socket.gethostname(),
|
||||
protocol=server_config.get("protocol", "http"),
|
||||
host=host,
|
||||
console_host=console_host,
|
||||
port=server_config.getint("port", 3080),
|
||||
user=server_config.get("user", ""),
|
||||
password=server_config.get("password", ""),
|
||||
|
||||
@@ -73,7 +73,7 @@ class Compute:
|
||||
A GNS3 compute.
|
||||
"""
|
||||
|
||||
def __init__(self, compute_id, controller=None, protocol="http", host="localhost", port=3080, user=None, password=None, name=None):
|
||||
def __init__(self, compute_id, controller=None, protocol="http", host="localhost", port=3080, user=None, password=None, name=None, console_host=None):
|
||||
self._http_session = None
|
||||
assert controller is not None
|
||||
log.info("Create compute %s", compute_id)
|
||||
@@ -87,6 +87,10 @@ class Compute:
|
||||
self.host = host
|
||||
self.port = port
|
||||
self._user = None
|
||||
if console_host is None:
|
||||
self._console_host = host
|
||||
else:
|
||||
self._console_host = console_host
|
||||
self._password = None
|
||||
self._connected = False
|
||||
self._closed = False # Close mean we are destroying the compute node
|
||||
@@ -214,6 +218,10 @@ class Compute:
|
||||
def host(self, host):
|
||||
self._host = host
|
||||
|
||||
@property
|
||||
def console_host(self):
|
||||
return self._console_host
|
||||
|
||||
@property
|
||||
def port(self):
|
||||
"""
|
||||
|
||||
@@ -568,7 +568,7 @@ class Node:
|
||||
"node_directory": self._node_directory,
|
||||
"name": self._name,
|
||||
"console": self._console,
|
||||
"console_host": str(self._compute.host),
|
||||
"console_host": str(self._compute.console_host),
|
||||
"console_type": self._console_type,
|
||||
"command_line": self._command_line,
|
||||
"properties": self._properties,
|
||||
|
||||
Reference in new issue
Block a user