mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-01 04:38:12 +00:00
Support for --version on the command line.
This commit is contained in:
parent
2a888f93ce
commit
4ae7875010
@ -33,6 +33,7 @@ from tornado.options import define
|
|||||||
define("host", default="0.0.0.0", help="run on the given host/IP address", type=str)
|
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("port", default=8000, help="run on the given port", type=int)
|
||||||
define("ipc", default=False, help="use IPC for module communication", type=bool)
|
define("ipc", default=False, help="use IPC for module communication", type=bool)
|
||||||
|
define("version", default=False, help="show the version", type=bool)
|
||||||
|
|
||||||
|
|
||||||
def locale_check():
|
def locale_check():
|
||||||
@ -78,6 +79,17 @@ def main():
|
|||||||
Entry point for GNS3 server
|
Entry point for GNS3 server
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
try:
|
||||||
|
tornado.options.parse_command_line()
|
||||||
|
except (tornado.options.Error, ValueError):
|
||||||
|
tornado.options.print_help()
|
||||||
|
raise SystemExit
|
||||||
|
|
||||||
|
from tornado.options import options
|
||||||
|
if options.version:
|
||||||
|
print(__version__)
|
||||||
|
raise SystemExit
|
||||||
|
|
||||||
if sys.platform.startswith("win"):
|
if sys.platform.startswith("win"):
|
||||||
# necessary on Windows to freeze the application
|
# necessary on Windows to freeze the application
|
||||||
multiprocessing.freeze_support()
|
multiprocessing.freeze_support()
|
||||||
@ -95,17 +107,10 @@ def main():
|
|||||||
micro=sys.version_info[2],
|
micro=sys.version_info[2],
|
||||||
pid=os.getpid()))
|
pid=os.getpid()))
|
||||||
|
|
||||||
try:
|
|
||||||
tornado.options.parse_command_line()
|
|
||||||
except (tornado.options.Error, ValueError):
|
|
||||||
tornado.options.print_help()
|
|
||||||
raise SystemExit
|
|
||||||
|
|
||||||
# check for the correct locale
|
# check for the correct locale
|
||||||
# (UNIX/Linux only)
|
# (UNIX/Linux only)
|
||||||
locale_check()
|
locale_check()
|
||||||
|
|
||||||
from tornado.options import options
|
|
||||||
server = Server(options.host,
|
server = Server(options.host,
|
||||||
options.port,
|
options.port,
|
||||||
ipc=options.ipc)
|
ipc=options.ipc)
|
||||||
|
@ -263,6 +263,30 @@ class IOU(IModule):
|
|||||||
|
|
||||||
log.debug("received request {}".format(request))
|
log.debug("received request {}".format(request))
|
||||||
|
|
||||||
|
def test_result(self, message, result="error"):
|
||||||
|
"""
|
||||||
|
"""
|
||||||
|
|
||||||
|
return {"result": result, "message": message}
|
||||||
|
|
||||||
|
@IModule.route("iou.test_settings")
|
||||||
|
def test_settings(self, request):
|
||||||
|
"""
|
||||||
|
"""
|
||||||
|
|
||||||
|
response = []
|
||||||
|
|
||||||
|
# test iourc
|
||||||
|
if self._iourc == "":
|
||||||
|
response.append(self.test_result("No iourc file has been added"))
|
||||||
|
elif not os.path.isfile(self._iourc):
|
||||||
|
response.append(self.test_result("iourc file {} is not accessible".format(self._iourc)))
|
||||||
|
else:
|
||||||
|
#TODO: check hostname + license inside the file
|
||||||
|
pass
|
||||||
|
|
||||||
|
self.send_response(response)
|
||||||
|
|
||||||
@IModule.route("iou.create")
|
@IModule.route("iou.create")
|
||||||
def iou_create(self, request):
|
def iou_create(self, request):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user