Skip to content

Commit

Permalink
Fix use project name instead of ID for fast duplication when running …
Browse files Browse the repository at this point in the history
…local server. Fixes #2446
  • Loading branch information
grossmj committed Nov 26, 2024
1 parent 11c9802 commit 83921a4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions gns3server/controller/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ async def add_node(self, compute, name, node_id, dump=True, node_type=None, **kw

if node_type == "iou":
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
# to generate MAC addresses) when creating multiple IOU node at the same time
if "properties" in kwargs.keys():
Expand Down Expand Up @@ -1275,7 +1275,10 @@ async def _fast_duplication(self, name=None, location=None, reset_mac_addresses=
p_work = pathlib.Path(location or self.path).parent.absolute()
t0 = time.time()
new_project_id = str(uuid.uuid4())
new_project_path = p_work.joinpath(new_project_id)
if location:
new_project_path = p_work.joinpath(location)
else:
new_project_path = p_work.joinpath(new_project_id)
# copy dir
await wait_run_in_executor(shutil.copytree, self.path, new_project_path.as_posix(), symlinks=True, ignore_dangling_symlinks=True)
log.info("Project content copied from '{}' to '{}' in {}s".format(self.path, new_project_path, time.time() - t0))
Expand Down

0 comments on commit 83921a4

Please sign in to comment.