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

Convert more that IOU pre 1.3 projects but also other modules on remote servers.

This commit is contained in:
grossmj 2015-03-09 21:46:23 -06:00
parent 5ca65093e4
commit ad5548f70b
2 changed files with 11 additions and 10 deletions

View File

@ -16,6 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import aiohttp
import stat
from ..config import Config
@ -56,7 +57,7 @@ class UploadHandler:
return
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":
destination_dir = os.path.expanduser("~/")

View File

@ -175,17 +175,17 @@ class BaseManager:
new_project_files_path, e))
if project.is_local() is False:
legacy_remote_iou_project = os.path.join(project.location, project.name, "iou")
new_iou_project_path = os.path.join(project.path, "project-files", "iou")
if os.path.exists(legacy_remote_iou_project) and not os.path.exists(new_iou_project_path):
# move the legacy remote IOU project (remote servers only)
log.info("Converting old remote IOU project...")
legacy_remote_project_path = os.path.join(project.location, project.name, self.module_name.lower())
new_remote_project_path = os.path.join(project.path, "project-files", self.module_name.lower())
if os.path.exists(legacy_remote_project_path) and not os.path.exists(new_remote_project_path):
# move the legacy remote project (remote servers only)
log.info("Converting old remote project...")
try:
log.info('Moving "{}" to "{}"'.format(legacy_remote_iou_project, new_iou_project_path))
yield from wait_run_in_executor(shutil.move, 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_project_path, new_remote_project_path)
except OSError as e:
raise aiohttp.web.HTTPInternalServerError(text="Could not move IOU directory: {} to {} {}".format(legacy_remote_iou_project,
new_iou_project_path, e))
raise aiohttp.web.HTTPInternalServerError(text="Could not move directory: {} to {} {}".format(legacy_remote_project_path,
new_remote_project_path, e))
if hasattr(self, "get_legacy_vm_workdir"):
# rename old project VM working dir