mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-28 11:18:11 +00:00
Add command information when uBridge has an error. Ref #1289
This commit is contained in:
parent
305fe2e817
commit
202e7362a5
@ -208,8 +208,8 @@ class UBridgeHypervisor:
|
|||||||
self._writer.write(command.encode())
|
self._writer.write(command.encode())
|
||||||
yield from self._writer.drain()
|
yield from self._writer.drain()
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
raise UbridgeError("Lost communication with {host}:{port} :{error}, Dynamips process running: {run}"
|
raise UbridgeError("Lost communication with {host}:{port} when sending command '{command}': {error}, uBridge process running: {run}"
|
||||||
.format(host=self._host, port=self._port, error=e, run=self.is_running()))
|
.format(host=self._host, port=self._port, command=command, error=e, run=self.is_running()))
|
||||||
|
|
||||||
# Now retrieve the result
|
# Now retrieve the result
|
||||||
data = []
|
data = []
|
||||||
@ -232,8 +232,8 @@ class UBridgeHypervisor:
|
|||||||
continue
|
continue
|
||||||
if not chunk:
|
if not chunk:
|
||||||
if retries > max_retries:
|
if retries > max_retries:
|
||||||
raise UbridgeError("No data returned from {host}:{port}, uBridge process running: {run}"
|
raise UbridgeError("No data returned from {host}:{port} after sending command '{command}', uBridge process running: {run}"
|
||||||
.format(host=self._host, port=self._port, run=self.is_running()))
|
.format(host=self._host, port=self._port, command=command, run=self.is_running()))
|
||||||
else:
|
else:
|
||||||
retries += 1
|
retries += 1
|
||||||
yield from asyncio.sleep(0.1)
|
yield from asyncio.sleep(0.1)
|
||||||
@ -241,16 +241,16 @@ class UBridgeHypervisor:
|
|||||||
retries = 0
|
retries = 0
|
||||||
buf += chunk.decode("utf-8")
|
buf += chunk.decode("utf-8")
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
raise UbridgeError("Lost communication with {host}:{port} :{error}, uBridge process running: {run}"
|
raise UbridgeError("Lost communication with {host}:{port} after sending command '{command}': {error}, uBridge process running: {run}"
|
||||||
.format(host=self._host, port=self._port, error=e, run=self.is_running()))
|
.format(host=self._host, port=self._port, command=command, error=e, run=self.is_running()))
|
||||||
|
|
||||||
# If the buffer doesn't end in '\n' then we can't be done
|
# If the buffer doesn't end in '\n' then we can't be done
|
||||||
try:
|
try:
|
||||||
if buf[-1] != '\n':
|
if buf[-1] != '\n':
|
||||||
continue
|
continue
|
||||||
except IndexError:
|
except IndexError:
|
||||||
raise UbridgeError("Could not communicate with {host}:{port}, uBridge process running: {run}"
|
raise UbridgeError("Could not communicate with {host}:{port} after sending command '{command}', uBridge process running: {run}"
|
||||||
.format(host=self._host, port=self._port, run=self.is_running()))
|
.format(host=self._host, port=self._port, command=command, run=self.is_running()))
|
||||||
|
|
||||||
data += buf.split('\r\n')
|
data += buf.split('\r\n')
|
||||||
if data[-1] == '':
|
if data[-1] == '':
|
||||||
|
Loading…
Reference in New Issue
Block a user