Skip to content

Commit

Permalink
Fix issues after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
grossmj committed Oct 31, 2024
1 parent c4fcb43 commit 7e90272
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions gns3server/controller/export_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import os
import sys
import json
import asyncio
import aiofiles
Expand Down
8 changes: 4 additions & 4 deletions gns3server/controller/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -1083,15 +1083,15 @@ async def duplicate(self, name=None, reset_mac_addresses=True):
assert self._status != "closed"

try:
proj = await self._fast_duplication(name, location, reset_mac_addresses)
proj = await self._fast_duplication(name, reset_mac_addresses)
if proj:
if previous_status == "closed":
await self.close()
return proj
else:
log.info("Fast duplication failed, fallback to normal duplication")
except Exception as e:
raise aiohttp.web.HTTPConflict(text="Cannot duplicate project: {}".format(str(e)))
raise ControllerError(f"Cannot duplicate project: {str(e)}")

try:
begin = time.time()
Expand Down Expand Up @@ -1332,7 +1332,7 @@ def asdict(self):
def __repr__(self):
return f"<gns3server.controller.Project {self._name} {self._id}>"

async def _fast_duplication(self, name=None, location=None, reset_mac_addresses=True):
async def _fast_duplication(self, name=None, reset_mac_addresses=True):
"""
Fast duplication of a project.
Expand All @@ -1349,7 +1349,7 @@ async def _fast_duplication(self, name=None, location=None, reset_mac_addresses=
log.warning("Fast duplication is not supported with remote compute: '{}'".format(compute.id))
return None
# work dir
p_work = pathlib.Path(location or self.path).parent.absolute()
p_work = pathlib.Path(self.path).parent.absolute()
t0 = time.time()
new_project_id = str(uuid.uuid4())
new_project_path = p_work.joinpath(new_project_id)
Expand Down
8 changes: 4 additions & 4 deletions tests/compute/docker/test_docker_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1812,10 +1812,10 @@ async def test_cpus(compute_project, manager):
],
"Privileged": True,
"Memory": 0,
"NanoCpus": 500000000
"NanoCpus": 500000000,
"UsernsMode": "host"
},
"Volumes": {},
"UsernsMode": "host",
"NetworkDisabled": True,
"Hostname": "test",
"Image": "ubuntu:latest",
Expand Down Expand Up @@ -1863,10 +1863,10 @@ async def test_memory(compute_project, manager):
],
"Privileged": True,
"Memory": 33554432, # 32MB in bytes
"NanoCpus": 0
"NanoCpus": 0,
"UsernsMode": "host",
},
"Volumes": {},
"UsernsMode": "host",
"NetworkDisabled": True,
"Hostname": "test",
"Image": "ubuntu:latest",
Expand Down

0 comments on commit 7e90272

Please sign in to comment.