mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-01-18 07:23:47 +02:00
Convert more that IOU pre 1.3 projects but also other modules on remote servers.
This commit is contained in:
parent
5ca65093e4
commit
ad5548f70b
@ -16,6 +16,7 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import aiohttp
|
||||||
import stat
|
import stat
|
||||||
|
|
||||||
from ..config import Config
|
from ..config import Config
|
||||||
@ -56,7 +57,7 @@ class UploadHandler:
|
|||||||
return
|
return
|
||||||
|
|
||||||
if data["type"] not in ["IOU", "IOURC", "QEMU", "IOS"]:
|
if data["type"] not in ["IOU", "IOURC", "QEMU", "IOS"]:
|
||||||
raise HTTPForbidden("You are not authorized to upload this kind of image {}".format(data["type"]))
|
raise aiohttp.web.HTTPForbidden("You are not authorized to upload this kind of image {}".format(data["type"]))
|
||||||
|
|
||||||
if data["type"] == "IOURC":
|
if data["type"] == "IOURC":
|
||||||
destination_dir = os.path.expanduser("~/")
|
destination_dir = os.path.expanduser("~/")
|
||||||
|
@ -175,17 +175,17 @@ class BaseManager:
|
|||||||
new_project_files_path, e))
|
new_project_files_path, e))
|
||||||
|
|
||||||
if project.is_local() is False:
|
if project.is_local() is False:
|
||||||
legacy_remote_iou_project = os.path.join(project.location, project.name, "iou")
|
legacy_remote_project_path = os.path.join(project.location, project.name, self.module_name.lower())
|
||||||
new_iou_project_path = os.path.join(project.path, "project-files", "iou")
|
new_remote_project_path = os.path.join(project.path, "project-files", self.module_name.lower())
|
||||||
if os.path.exists(legacy_remote_iou_project) and not os.path.exists(new_iou_project_path):
|
if os.path.exists(legacy_remote_project_path) and not os.path.exists(new_remote_project_path):
|
||||||
# move the legacy remote IOU project (remote servers only)
|
# move the legacy remote project (remote servers only)
|
||||||
log.info("Converting old remote IOU project...")
|
log.info("Converting old remote project...")
|
||||||
try:
|
try:
|
||||||
log.info('Moving "{}" to "{}"'.format(legacy_remote_iou_project, new_iou_project_path))
|
log.info('Moving "{}" to "{}"'.format(legacy_remote_project_path, new_remote_project_path))
|
||||||
yield from wait_run_in_executor(shutil.move, legacy_remote_iou_project, new_iou_project_path)
|
yield from wait_run_in_executor(shutil.move, legacy_remote_project_path, new_remote_project_path)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
raise aiohttp.web.HTTPInternalServerError(text="Could not move IOU directory: {} to {} {}".format(legacy_remote_iou_project,
|
raise aiohttp.web.HTTPInternalServerError(text="Could not move directory: {} to {} {}".format(legacy_remote_project_path,
|
||||||
new_iou_project_path, e))
|
new_remote_project_path, e))
|
||||||
|
|
||||||
if hasattr(self, "get_legacy_vm_workdir"):
|
if hasattr(self, "get_legacy_vm_workdir"):
|
||||||
# rename old project VM working dir
|
# rename old project VM working dir
|
||||||
|
Loading…
Reference in New Issue
Block a user