mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-06 07:11:13 +02:00
New base server.
This commit is contained in:
1 parent
5e665cc67a
commit
61344a1669
51 files changed
+2632
-1835
No files matched your search
+11
-12
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2013 GNS3 Technologies Inc.
|
||||
# Copyright (C) 2015 GNS3 Technologies Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -19,20 +19,23 @@
|
||||
import os
|
||||
import datetime
|
||||
import sys
|
||||
import multiprocessing
|
||||
import locale
|
||||
|
||||
#TODO: importing this module also configures logging options (colors etc.)
|
||||
#see https://github.com/tornadoweb/tornado/blob/master/tornado/log.py#L208
|
||||
import tornado.options
|
||||
|
||||
from gns3server.server import Server
|
||||
from gns3server.version import __version__
|
||||
|
||||
import logging
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
#TODO: migrate command line options to argparse
|
||||
# command line options
|
||||
from tornado.options import define
|
||||
define("host", default="0.0.0.0", help="run on the given host/IP address", type=str)
|
||||
define("port", default=8000, help="run on the given port", type=int)
|
||||
define("ipc", default=False, help="use IPC for module communication", type=bool)
|
||||
define("version", default=False, help="show the version", type=bool)
|
||||
define("quiet", default=False, help="do not show output on stdout", type=bool)
|
||||
define("console_bind_to_any", default=True, help="bind console ports to any local IP address", type=bool)
|
||||
@@ -50,7 +53,7 @@ def locale_check():
|
||||
or there: http://robjwells.com/post/61198832297/get-your-us-ascii-out-of-my-face
|
||||
"""
|
||||
|
||||
# no need to check on Windows or when frozen
|
||||
# no need to check on Windows or when this application is frozen
|
||||
if sys.platform.startswith("win") or hasattr(sys, "frozen"):
|
||||
return
|
||||
|
||||
@@ -82,10 +85,7 @@ def main():
|
||||
Entry point for GNS3 server
|
||||
"""
|
||||
|
||||
if sys.platform.startswith("win"):
|
||||
# necessary on Windows to freeze the application
|
||||
multiprocessing.freeze_support()
|
||||
|
||||
#TODO: migrate command line options to argparse (don't forget the quiet mode).
|
||||
try:
|
||||
tornado.options.parse_command_line()
|
||||
except (tornado.options.Error, ValueError):
|
||||
@@ -109,6 +109,7 @@ def main():
|
||||
|
||||
user_log.info("GNS3 server version {}".format(__version__))
|
||||
user_log.info("Copyright (c) 2007-{} GNS3 Technologies Inc.".format(current_year))
|
||||
#TODO: end todo
|
||||
|
||||
# we only support Python 3 version >= 3.3
|
||||
if sys.version_info < (3, 3):
|
||||
@@ -118,8 +119,7 @@ def main():
|
||||
major=sys.version_info[0], minor=sys.version_info[1],
|
||||
micro=sys.version_info[2], pid=os.getpid()))
|
||||
|
||||
# check for the correct locale
|
||||
# (UNIX/Linux only)
|
||||
# check for the correct locale (UNIX/Linux only)
|
||||
locale_check()
|
||||
|
||||
try:
|
||||
@@ -128,8 +128,7 @@ def main():
|
||||
log.critical("the current working directory doesn't exist")
|
||||
return
|
||||
|
||||
server = Server(options.host, options.port, options.ipc, options.console_bind_to_any)
|
||||
server.load_modules()
|
||||
server = Server(options.host, options.port, options.console_bind_to_any)
|
||||
server.run()
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in new issue
Block a user