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

Add an error message when Docker container is not ready to be started. Ref #1281.

This commit is contained in:
grossmj 2018-02-02 16:29:08 +08:00
parent 07d2d7b340
commit 4ba523a0d7
2 changed files with 7 additions and 3 deletions

View File

@ -352,7 +352,11 @@ class DockerVM(BaseNode):
def start(self): def start(self):
"""Starts this Docker container.""" """Starts this Docker container."""
try:
state = yield from self._get_container_state() state = yield from self._get_container_state()
except DockerHttp404Error:
raise DockerError("Docker container '{name}' with ID {cid} does not exist or is not ready yet. Please try again in a few seconds.".format(name=self.name,
cid=self._cid))
if state == "paused": if state == "paused":
yield from self.unpause() yield from self.unpause()
elif state == "running": elif state == "running":

View File

@ -396,12 +396,12 @@ class VMware(BaseManager):
try: try:
stdout_data, _ = yield from asyncio.wait_for(process.communicate(), timeout=timeout) stdout_data, _ = yield from asyncio.wait_for(process.communicate(), timeout=timeout)
except asyncio.TimeoutError: except asyncio.TimeoutError:
raise VMwareError("vmrun has timed out after {} seconds!\nTry to run {} in a terminal to see more informations.\n\nMake sure GNS3 and VMware run under the same user and whitelist vmrun.exe in your antivirus.".format(timeout, command_string)) raise VMwareError("vmrun has timed out after {} seconds!\nTry to run {} in a terminal to see more details.\n\nMake sure GNS3 and VMware run under the same user and whitelist vmrun.exe in your antivirus.".format(timeout, command_string))
if process.returncode: if process.returncode:
# vmrun print errors on stdout # vmrun print errors on stdout
vmrun_error = stdout_data.decode("utf-8", errors="ignore") vmrun_error = stdout_data.decode("utf-8", errors="ignore")
raise VMwareError("vmrun has returned an error: {}\nTry to run {} in a terminal to see more informations.\nAnd make sure GNS3 and VMware run under the same user.".format(vmrun_error, command_string)) raise VMwareError("vmrun has returned an error: {}\nTry to run {} in a terminal to see more details.\nAnd make sure GNS3 and VMware run under the same user.".format(vmrun_error, command_string))
return stdout_data.decode("utf-8", errors="ignore").splitlines() return stdout_data.decode("utf-8", errors="ignore").splitlines()