mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-28 11:18:11 +00:00
Strip user from compute in topology and return project filename
This commit is contained in:
parent
c4d619ce3c
commit
aa5988788d
@ -238,8 +238,7 @@ class Compute:
|
||||
"name": self._name,
|
||||
"protocol": self._protocol,
|
||||
"host": self._host,
|
||||
"port": self._port,
|
||||
"user": self._user
|
||||
"port": self._port
|
||||
}
|
||||
return {
|
||||
"compute_id": self._id,
|
||||
|
@ -322,12 +322,14 @@ class Project:
|
||||
raise aiohttp.web.HTTPInternalServerError(text="Could not create project directory: {}".format(e))
|
||||
return path
|
||||
|
||||
def _topology_file(self):
|
||||
def _filename(self):
|
||||
if self.name is None:
|
||||
filename = "untitled.gns3"
|
||||
return "untitled.gns3"
|
||||
else:
|
||||
filename = self.name + ".gns3"
|
||||
return os.path.join(self.path, filename)
|
||||
return self.name + ".gns3"
|
||||
|
||||
def _topology_file(self):
|
||||
return os.path.join(self.path, self._filename())
|
||||
|
||||
@asyncio.coroutine
|
||||
def open(self):
|
||||
@ -371,5 +373,6 @@ class Project:
|
||||
"name": self._name,
|
||||
"project_id": self._id,
|
||||
"path": self._path,
|
||||
"filename": self._filename(),
|
||||
"status": self._status
|
||||
}
|
||||
|
@ -82,6 +82,11 @@ PROJECT_OBJECT_SCHEMA = {
|
||||
"type": ["string", "null"],
|
||||
"minLength": 1
|
||||
},
|
||||
"filename": {
|
||||
"description": "Project filename",
|
||||
"type": ["string", "null"],
|
||||
"minLength": 1
|
||||
},
|
||||
"status": {
|
||||
"description": "Project status Read only",
|
||||
"enum": ["opened", "closed"]
|
||||
|
@ -211,7 +211,6 @@ def test_json(compute):
|
||||
"protocol": "https",
|
||||
"host": "example.com",
|
||||
"port": 84,
|
||||
"user": "test",
|
||||
}
|
||||
|
||||
|
||||
|
@ -43,7 +43,7 @@ def test_affect_uuid():
|
||||
|
||||
def test_json(tmpdir):
|
||||
p = Project()
|
||||
assert p.__json__() == {"name": p.name, "project_id": p.id, "path": p.path, "status": "opened"}
|
||||
assert p.__json__() == {"name": p.name, "project_id": p.id, "path": p.path, "status": "opened", "filename": "untitled.gns3"}
|
||||
|
||||
|
||||
def test_path(tmpdir):
|
||||
|
Loading…
Reference in New Issue
Block a user