Skip to content

Commit 7e90272

Browse files
committed
Fix issues after merge
1 parent c4fcb43 commit 7e90272

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

gns3server/controller/export_project.py

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1717

1818
import os
19+
import sys
1920
import json
2021
import asyncio
2122
import aiofiles

gns3server/controller/project.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1083,15 +1083,15 @@ async def duplicate(self, name=None, reset_mac_addresses=True):
10831083
assert self._status != "closed"
10841084

10851085
try:
1086-
proj = await self._fast_duplication(name, location, reset_mac_addresses)
1086+
proj = await self._fast_duplication(name, reset_mac_addresses)
10871087
if proj:
10881088
if previous_status == "closed":
10891089
await self.close()
10901090
return proj
10911091
else:
10921092
log.info("Fast duplication failed, fallback to normal duplication")
10931093
except Exception as e:
1094-
raise aiohttp.web.HTTPConflict(text="Cannot duplicate project: {}".format(str(e)))
1094+
raise ControllerError(f"Cannot duplicate project: {str(e)}")
10951095

10961096
try:
10971097
begin = time.time()
@@ -1332,7 +1332,7 @@ def asdict(self):
13321332
def __repr__(self):
13331333
return f"<gns3server.controller.Project {self._name} {self._id}>"
13341334

1335-
async def _fast_duplication(self, name=None, location=None, reset_mac_addresses=True):
1335+
async def _fast_duplication(self, name=None, reset_mac_addresses=True):
13361336
"""
13371337
Fast duplication of a project.
13381338
@@ -1349,7 +1349,7 @@ async def _fast_duplication(self, name=None, location=None, reset_mac_addresses=
13491349
log.warning("Fast duplication is not supported with remote compute: '{}'".format(compute.id))
13501350
return None
13511351
# work dir
1352-
p_work = pathlib.Path(location or self.path).parent.absolute()
1352+
p_work = pathlib.Path(self.path).parent.absolute()
13531353
t0 = time.time()
13541354
new_project_id = str(uuid.uuid4())
13551355
new_project_path = p_work.joinpath(new_project_id)

tests/compute/docker/test_docker_vm.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1812,10 +1812,10 @@ async def test_cpus(compute_project, manager):
18121812
],
18131813
"Privileged": True,
18141814
"Memory": 0,
1815-
"NanoCpus": 500000000
1815+
"NanoCpus": 500000000,
1816+
"UsernsMode": "host"
18161817
},
18171818
"Volumes": {},
1818-
"UsernsMode": "host",
18191819
"NetworkDisabled": True,
18201820
"Hostname": "test",
18211821
"Image": "ubuntu:latest",
@@ -1863,10 +1863,10 @@ async def test_memory(compute_project, manager):
18631863
],
18641864
"Privileged": True,
18651865
"Memory": 33554432, # 32MB in bytes
1866-
"NanoCpus": 0
1866+
"NanoCpus": 0,
1867+
"UsernsMode": "host",
18671868
},
18681869
"Volumes": {},
1869-
"UsernsMode": "host",
18701870
"NetworkDisabled": True,
18711871
"Hostname": "test",
18721872
"Image": "ubuntu:latest",

0 commit comments

Comments
 (0)