1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-28 11:18:11 +00:00

Use projects_path & images_path.

This commit is contained in:
Jeremy 2015-02-23 17:08:34 -07:00
parent fb9f5d3c14
commit 182d2e465e
3 changed files with 8 additions and 5 deletions

View File

@ -72,4 +72,4 @@ class UploadHandler:
@staticmethod @staticmethod
def image_directory(): def image_directory():
server_config = Config.instance().get_section_config("Server") server_config = Config.instance().get_section_config("Server")
return os.path.expanduser(server_config.get("image_directory", "~/GNS3/images")) return os.path.expanduser(server_config.get("images_path", "~/GNS3/images"))

View File

@ -91,7 +91,8 @@ class Project:
depending of the operating system depending of the operating system
""" """
path = os.path.normpath(os.path.expanduser("~/GNS3/projects")) server_config = Config.instance().get_section_config("Server")
path = os.path.expanduser(server_config.get("projects_path", "~/GNS3/projects"))
try: try:
os.makedirs(path, exist_ok=True) os.makedirs(path, exist_ok=True)
except OSError as e: except OSError as e:

View File

@ -142,9 +142,11 @@ class Server:
@asyncio.coroutine @asyncio.coroutine
def start_shell(self): def start_shell(self):
from ptpython.repl import embed try:
from gns3server.modules import Qemu from ptpython.repl import embed
except ImportError:
log.error("Unable to start a shell: the ptpython module must be installed!")
return
yield from embed(globals(), locals(), return_asyncio_coroutine=True, patch_stdout=True) yield from embed(globals(), locals(), return_asyncio_coroutine=True, patch_stdout=True)
def run(self): def run(self):