mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-06-12 20:38:23 +00:00
Updated tests for setting docker user
This commit is contained in:
@ -311,7 +311,6 @@ class DockerVM(BaseNode):
|
||||
"Tty": True,
|
||||
"OpenStdin": True,
|
||||
"StdinOnce": False,
|
||||
"User": "root",
|
||||
"HostConfig": {
|
||||
"CapAdd": ["ALL"],
|
||||
"Privileged": True,
|
||||
@ -320,7 +319,7 @@ class DockerVM(BaseNode):
|
||||
"Volumes": {},
|
||||
"Env": ["container=docker"], # Systemd compliant: https://github.com/GNS3/gns3-server/issues/573
|
||||
"Cmd": [],
|
||||
"Entrypoint": image_infos.get("Config", {"Entrypoint": []})["Entrypoint"]
|
||||
"Entrypoint": image_infos.get("Config", {"Entrypoint": []}).get("Entrypoint")
|
||||
}
|
||||
|
||||
if params["Entrypoint"] is None:
|
||||
@ -331,7 +330,7 @@ class DockerVM(BaseNode):
|
||||
except ValueError as e:
|
||||
raise DockerError("Invalid start command '{}': {}".format(self._start_command, e))
|
||||
if len(params["Cmd"]) == 0:
|
||||
params["Cmd"] = image_infos.get("Config", {"Cmd": []})["Cmd"]
|
||||
params["Cmd"] = image_infos.get("Config", {"Cmd": []}).get("Cmd")
|
||||
if params["Cmd"] is None:
|
||||
params["Cmd"] = []
|
||||
if len(params["Cmd"]) == 0 and len(params["Entrypoint"]) == 0:
|
||||
@ -344,7 +343,9 @@ class DockerVM(BaseNode):
|
||||
params["Env"].append("GNS3_VOLUMES={}".format(":".join(self._volumes)))
|
||||
|
||||
# Pass user configured for image to init script
|
||||
params["Env"].append("GNS3_USER={}".format(image_infos.get("Config", {"User": ""})["User"]))
|
||||
if image_infos.get("Config", {"User": ""}).get("User"):
|
||||
params["User"] = "root"
|
||||
params["Env"].append("GNS3_USER={}".format(image_infos.get("Config", {"User": ""})["User"]))
|
||||
|
||||
variables = self.project.variables
|
||||
if not variables:
|
||||
|
Reference in New Issue
Block a user