mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-26 16:58:28 +00:00
Use module settings from the config file.
This commit is contained in:
parent
2c3fe2ad4b
commit
45ca493ecf
@ -112,15 +112,13 @@ def main():
|
|||||||
args = parse_arguments()
|
args = parse_arguments()
|
||||||
if args.debug:
|
if args.debug:
|
||||||
level = logging.DEBUG
|
level = logging.DEBUG
|
||||||
user_log = init_logger(level, quiet=args.quiet)
|
|
||||||
|
|
||||||
user_log = init_logger(logging.INFO)
|
user_log = init_logger(level, quiet=args.quiet)
|
||||||
user_log.info("GNS3 server version {}".format(__version__))
|
user_log.info("GNS3 server version {}".format(__version__))
|
||||||
current_year = datetime.date.today().year
|
current_year = datetime.date.today().year
|
||||||
user_log.info("Copyright (c) 2007-{} GNS3 Technologies Inc.".format(current_year))
|
user_log.info("Copyright (c) 2007-{} GNS3 Technologies Inc.".format(current_year))
|
||||||
|
|
||||||
set_config(args)
|
set_config(args)
|
||||||
|
|
||||||
server_config = Config.instance().get_section_config("Server")
|
server_config = Config.instance().get_section_config("Server")
|
||||||
if server_config.getboolean("local"):
|
if server_config.getboolean("local"):
|
||||||
log.warning("Local mode is enabled. Beware, clients will have full control on your filesystem")
|
log.warning("Local mode is enabled. Beware, clients will have full control on your filesystem")
|
||||||
|
@ -44,9 +44,12 @@ class PortManager:
|
|||||||
console_start_port_range = server_config.getint("console_start_port_range", 2000)
|
console_start_port_range = server_config.getint("console_start_port_range", 2000)
|
||||||
console_end_port_range = server_config.getint("console_end_port_range", 5000)
|
console_end_port_range = server_config.getint("console_end_port_range", 5000)
|
||||||
self._console_port_range = (console_start_port_range, console_end_port_range)
|
self._console_port_range = (console_start_port_range, console_end_port_range)
|
||||||
|
log.debug("Console port range is {}-{}".format(console_start_port_range, console_end_port_range))
|
||||||
|
|
||||||
udp_start_port_range = server_config.getint("udp_start_port_range", 10000)
|
udp_start_port_range = server_config.getint("udp_start_port_range", 10000)
|
||||||
udp_end_port_range = server_config.getint("udp_end_port_range", 20000)
|
udp_end_port_range = server_config.getint("udp_end_port_range", 20000)
|
||||||
self._udp_port_range = (udp_start_port_range, udp_end_port_range)
|
self._udp_port_range = (udp_start_port_range, udp_end_port_range)
|
||||||
|
log.debug("UDP port range is {}-{}".format(udp_start_port_range, udp_end_port_range))
|
||||||
|
|
||||||
if remote_console_connections:
|
if remote_console_connections:
|
||||||
log.warning("Remote console connections are allowed")
|
log.warning("Remote console connections are allowed")
|
||||||
|
@ -38,7 +38,6 @@ class VirtualBox(BaseManager):
|
|||||||
|
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self._vboxmanage_path = None
|
self._vboxmanage_path = None
|
||||||
self._vbox_user = None
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def vboxmanage_path(self):
|
def vboxmanage_path(self):
|
||||||
@ -50,16 +49,6 @@ class VirtualBox(BaseManager):
|
|||||||
|
|
||||||
return self._vboxmanage_path
|
return self._vboxmanage_path
|
||||||
|
|
||||||
@property
|
|
||||||
def vbox_user(self):
|
|
||||||
"""
|
|
||||||
Returns the VirtualBox user
|
|
||||||
|
|
||||||
:returns: username
|
|
||||||
"""
|
|
||||||
|
|
||||||
return self._vbox_user
|
|
||||||
|
|
||||||
def find_vboxmanage(self):
|
def find_vboxmanage(self):
|
||||||
|
|
||||||
# look for VBoxManage
|
# look for VBoxManage
|
||||||
@ -94,9 +83,10 @@ class VirtualBox(BaseManager):
|
|||||||
command = [vboxmanage_path, "--nologo", subcommand]
|
command = [vboxmanage_path, "--nologo", subcommand]
|
||||||
command.extend(args)
|
command.extend(args)
|
||||||
try:
|
try:
|
||||||
if self.vbox_user:
|
vbox_user = self.config.get_section_config("VirtualBox").get("vbox_user")
|
||||||
|
if vbox_user:
|
||||||
# TODO: test & review this part
|
# TODO: test & review this part
|
||||||
sudo_command = "sudo -i -u {}".format(self.vbox_user) + " ".join(command)
|
sudo_command = "sudo -i -u {}".format(vbox_user) + " ".join(command)
|
||||||
process = yield from asyncio.create_subprocess_shell(sudo_command, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE)
|
process = yield from asyncio.create_subprocess_shell(sudo_command, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE)
|
||||||
else:
|
else:
|
||||||
process = yield from asyncio.create_subprocess_exec(*command, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE)
|
process = yield from asyncio.create_subprocess_exec(*command, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE)
|
||||||
|
@ -57,10 +57,8 @@ class VPCSVM(BaseVM):
|
|||||||
|
|
||||||
super().__init__(name, uuid, project, manager)
|
super().__init__(name, uuid, project, manager)
|
||||||
|
|
||||||
self._path = manager.config.get_section_config("VPCS").get("path", "vpcs")
|
self._path = manager.config.get_section_config("VPCS").get("vpcs_path", "vpcs")
|
||||||
|
|
||||||
self._console = console
|
self._console = console
|
||||||
|
|
||||||
self._command = []
|
self._command = []
|
||||||
self._process = None
|
self._process = None
|
||||||
self._vpcs_stdout_file = ""
|
self._vpcs_stdout_file = ""
|
||||||
|
Loading…
Reference in New Issue
Block a user