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