1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-28 11:18:11 +00:00

Fix export of projects with docker with a / in the image name

Fix #834
This commit is contained in:
Julien Duponchelle 2016-12-14 18:57:59 +01:00
parent 1b6411f88e
commit 74a7e630d3
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8
2 changed files with 9 additions and 2 deletions

View File

@ -142,7 +142,7 @@ def _export_project_file(project, path, z, include_images, keep_compute_id, allo
if not keep_compute_id:
node["compute_id"] = "local" # To make project portable all node by default run on local
if "properties" in node and node["node_type"] != "Docker":
if "properties" in node and node["node_type"] != "docker":
for prop, value in node["properties"].items():
if prop.endswith("image"):
if not keep_compute_id: # If we keep the original compute we can keep the image path

View File

@ -207,7 +207,7 @@ def test_export_disallow_some_type(tmpdir, project, async_run):
def test_export_fix_path(tmpdir, project, async_run):
"""
Fix absolute image path
Fix absolute image path, except for Docker
"""
path = project.path
@ -220,6 +220,12 @@ def test_export_fix_path(tmpdir, project, async_run):
"image": "/tmp/c3725-adventerprisek9-mz.124-25d.image"
},
"node_type": "dynamips"
},
{
"properties": {
"image": "gns3/webterm:lastest"
},
"node_type": "docker"
}
]
}
@ -238,6 +244,7 @@ def test_export_fix_path(tmpdir, project, async_run):
content = myfile.read().decode()
topology = json.loads(content)
assert topology["topology"]["nodes"][0]["properties"]["image"] == "c3725-adventerprisek9-mz.124-25d.image"
assert topology["topology"]["nodes"][1]["properties"]["image"] == "gns3/webterm:lastest"
def test_export_with_images(tmpdir, project, async_run):