Merge branch '3.0' into image-management-refactoring

# Conflicts:
#	gns3server/api/routes/controller/permissions.py
This commit is contained in:
grossmj committed 2021-09-20 17:06:46 +09:30
commit d8bceaad5d
618 files changed
+4841 -13708

No files matched your search

+1 -1
View File
@@ -357,7 +357,7 @@ if __name__ == "__main__":
# Demo using telnet
shell = Demo(welcome_message="Welcome!\n")
server = create_telnet_shell(shell, loop=loop)
coro = asyncio.start_server(server.run, "127.0.0.1", 4444, loop=loop)
coro = asyncio.start_server(server.run, "127.0.0.1", 4444)
s = loop.run_until_complete(coro)
try:
loop.run_forever()
@@ -127,7 +127,7 @@ if __name__ == "__main__":
)
],
)
coro = asyncio.start_server(server.run, "0.0.0.0", 4444, loop=loop)
coro = asyncio.start_server(server.run, "0.0.0.0", 4444)
s = loop.run_until_complete(coro)
try:
+1 -1
View File
@@ -420,7 +420,7 @@ if __name__ == "__main__":
)
server = AsyncioTelnetServer(reader=process.stdout, writer=process.stdin, binary=False, echo=False)
coro = asyncio.start_server(server.run, "127.0.0.1", 4444, loop=loop)
coro = asyncio.start_server(server.run, "127.0.0.1", 4444)
s = loop.run_until_complete(coro)
try:
+14 -1
View File
@@ -48,7 +48,7 @@ def is_safe_path(file_path: str, basedir: str) -> bool:
return Path(basedir).resolve() in test_path.resolve().parents
def check_path_allowed(path):
def check_path_allowed(path: str):
"""
If the server is non local raise an error if
the path is outside project directories
@@ -62,3 +62,16 @@ def check_path_allowed(path):
if Config.instance().settings.Server.local is False:
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail="The path is not allowed")
def get_mountpoint(path: str):
"""
Find the mount point of a path.
"""
path = os.path.abspath(path)
while path != os.path.sep:
if os.path.ismount(path):
return path
path = os.path.abspath(os.path.join(path, os.pardir))
return path