mirror of
https://github.com/GNS3/gns3-server
synced 2025-05-08 10:08:43 +00:00
Fix use project name instead of ID for fast duplication when running local server. Fixes #2446
This commit is contained in:
parent
11c9802268
commit
83921a45df
@ -588,7 +588,7 @@ class Project:
|
|||||||
|
|
||||||
if node_type == "iou":
|
if node_type == "iou":
|
||||||
async with self._iou_id_lock:
|
async with self._iou_id_lock:
|
||||||
# wait for a IOU node to be completely created before adding a new one
|
# wait for an IOU node to be completely created before adding a new one
|
||||||
# this is important otherwise we allocate the same application ID (used
|
# this is important otherwise we allocate the same application ID (used
|
||||||
# to generate MAC addresses) when creating multiple IOU node at the same time
|
# to generate MAC addresses) when creating multiple IOU node at the same time
|
||||||
if "properties" in kwargs.keys():
|
if "properties" in kwargs.keys():
|
||||||
@ -1275,6 +1275,9 @@ class Project:
|
|||||||
p_work = pathlib.Path(location or self.path).parent.absolute()
|
p_work = pathlib.Path(location or self.path).parent.absolute()
|
||||||
t0 = time.time()
|
t0 = time.time()
|
||||||
new_project_id = str(uuid.uuid4())
|
new_project_id = str(uuid.uuid4())
|
||||||
|
if location:
|
||||||
|
new_project_path = p_work.joinpath(location)
|
||||||
|
else:
|
||||||
new_project_path = p_work.joinpath(new_project_id)
|
new_project_path = p_work.joinpath(new_project_id)
|
||||||
# copy dir
|
# copy dir
|
||||||
await wait_run_in_executor(shutil.copytree, self.path, new_project_path.as_posix(), symlinks=True, ignore_dangling_symlinks=True)
|
await wait_run_in_executor(shutil.copytree, self.path, new_project_path.as_posix(), symlinks=True, ignore_dangling_symlinks=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user