mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-28 11:18:11 +00:00
parent
1b6411f88e
commit
74a7e630d3
@ -142,7 +142,7 @@ def _export_project_file(project, path, z, include_images, keep_compute_id, allo
|
|||||||
if not keep_compute_id:
|
if not keep_compute_id:
|
||||||
node["compute_id"] = "local" # To make project portable all node by default run on local
|
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():
|
for prop, value in node["properties"].items():
|
||||||
if prop.endswith("image"):
|
if prop.endswith("image"):
|
||||||
if not keep_compute_id: # If we keep the original compute we can keep the image path
|
if not keep_compute_id: # If we keep the original compute we can keep the image path
|
||||||
|
@ -207,7 +207,7 @@ def test_export_disallow_some_type(tmpdir, project, async_run):
|
|||||||
|
|
||||||
def test_export_fix_path(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
|
path = project.path
|
||||||
@ -220,6 +220,12 @@ def test_export_fix_path(tmpdir, project, async_run):
|
|||||||
"image": "/tmp/c3725-adventerprisek9-mz.124-25d.image"
|
"image": "/tmp/c3725-adventerprisek9-mz.124-25d.image"
|
||||||
},
|
},
|
||||||
"node_type": "dynamips"
|
"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()
|
content = myfile.read().decode()
|
||||||
topology = json.loads(content)
|
topology = json.loads(content)
|
||||||
assert topology["topology"]["nodes"][0]["properties"]["image"] == "c3725-adventerprisek9-mz.124-25d.image"
|
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):
|
def test_export_with_images(tmpdir, project, async_run):
|
||||||
|
Loading…
Reference in New Issue
Block a user