1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-13 20:08:55 +00:00

Export the list of volumes to a env variable accessible in the container

Ref #550
This commit is contained in:
Julien Duponchelle 2016-06-01 11:39:42 +02:00
parent d3436756b2
commit ae687346f1
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8
2 changed files with 20 additions and 10 deletions

View File

@ -294,6 +294,8 @@ class DockerVM(BaseVM):
# Give the information to the container on how many interface should be inside
params["Env"].append("GNS3_MAX_ETHERNET=eth{}".format(self.adapters - 1))
# Give the information to the container the list of volume path mounted
params["Env"].append("GNS3_VOLUMES={}".format(":".join(self._volumes)))
if self._environment:
params["Env"] += [e.strip() for e in self._environment.split("\n")]

View File

@ -104,7 +104,8 @@ def test_create(loop, project, manager):
"Hostname": "test",
"Image": "ubuntu:latest",
"Env": [
"GNS3_MAX_ETHERNET=eth0"
"GNS3_MAX_ETHERNET=eth0",
"GNS3_VOLUMES=/etc/network"
],
"Entrypoint": ["/gns3/init.sh"],
"Cmd": ["/bin/sh"]
@ -141,8 +142,9 @@ def test_create_with_tag(loop, project, manager):
"Hostname": "test",
"Image": "ubuntu:latest:16.04",
"Env": [
"GNS3_MAX_ETHERNET=eth0"
],
"GNS3_MAX_ETHERNET=eth0",
"GNS3_VOLUMES=/etc/network"
],
"Entrypoint": ["/gns3/init.sh"],
"Cmd": ["/bin/sh"]
})
@ -183,8 +185,9 @@ def test_create_vnc(loop, project, manager):
"Image": "ubuntu:latest",
"Env": [
"GNS3_MAX_ETHERNET=eth0",
"GNS3_VOLUMES=/etc/network",
"DISPLAY=:42"
],
],
"Entrypoint": ["/gns3/init.sh"],
"Cmd": ["/bin/sh"]
})
@ -225,8 +228,9 @@ def test_create_start_cmd(loop, project, manager):
"Hostname": "test",
"Image": "ubuntu:latest",
"Env": [
"GNS3_MAX_ETHERNET=eth0"
]
"GNS3_MAX_ETHERNET=eth0",
"GNS3_VOLUMES=/etc/network"
]
})
assert vm._cid == "e90e34656806"
@ -257,6 +261,7 @@ def test_create_environment(loop, project, manager):
},
"Env": [
"GNS3_MAX_ETHERNET=eth0",
"GNS3_VOLUMES=/etc/network",
"YES=1",
"NO=0"
],
@ -315,8 +320,9 @@ def test_create_image_not_available(loop, project, manager):
"Hostname": "test",
"Image": "ubuntu:latest",
"Env": [
"GNS3_MAX_ETHERNET=eth0"
],
"GNS3_MAX_ETHERNET=eth0",
"GNS3_VOLUMES=/etc/network"
],
"Entrypoint": ["/gns3/init.sh"],
"Cmd": ["/bin/sh"]
})
@ -534,7 +540,8 @@ def test_update(loop, vm):
"Hostname": "test",
"Image": "ubuntu:latest",
"Env": [
"GNS3_MAX_ETHERNET=eth0"
"GNS3_MAX_ETHERNET=eth0",
"GNS3_VOLUMES=/etc/network"
],
"Entrypoint": ["/gns3/init.sh"],
"Cmd": ["/bin/sh"]
@ -601,7 +608,8 @@ def test_update_running(loop, vm):
"Hostname": "test",
"Image": "ubuntu:latest",
"Env": [
"GNS3_MAX_ETHERNET=eth0"
"GNS3_MAX_ETHERNET=eth0",
"GNS3_VOLUMES=/etc/network"
],
"Entrypoint": ["/gns3/init.sh"],
"Cmd": ["/bin/sh"]