mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-12 19:38:57 +00:00
Ignore Unicode errors when executing vboxmanage.
This commit is contained in:
parent
7f37f649da
commit
7785c03eac
@ -474,8 +474,8 @@ class DynamipsHypervisor(object):
|
||||
log.debug("sending {}".format(command))
|
||||
self.socket.sendall(command.encode('utf-8'))
|
||||
except OSError as e:
|
||||
raise DynamipsError("Lost communication with {host}:{port} :{error}"
|
||||
.format(host=self._host, port=self._port, error=e))
|
||||
raise DynamipsError("Lost communication with {host}:{port} :{error}, Dynamips process running: {run}"
|
||||
.format(host=self._host, port=self._port, error=e, run=self.is_running()))
|
||||
|
||||
# Now retrieve the result
|
||||
data = []
|
||||
@ -485,16 +485,16 @@ class DynamipsHypervisor(object):
|
||||
chunk = self.socket.recv(1024) # match to Dynamips' buffer size
|
||||
buf += chunk.decode("utf-8")
|
||||
except OSError as e:
|
||||
raise DynamipsError("Communication timed out with {host}:{port} :{error}"
|
||||
.format(host=self._host, port=self._port, error=e))
|
||||
raise DynamipsError("Communication timed out with {host}:{port} :{error}, Dynamips process running: {run}"
|
||||
.format(host=self._host, port=self._port, error=e, run=self.is_running()))
|
||||
|
||||
# If the buffer doesn't end in '\n' then we can't be done
|
||||
try:
|
||||
if buf[-1] != '\n':
|
||||
continue
|
||||
except IndexError:
|
||||
raise DynamipsError("Could not communicate with {host}:{port}"
|
||||
.format(host=self._host, port=self._port))
|
||||
raise DynamipsError("Could not communicate with {host}:{port}, Dynamips process running: {run}"
|
||||
.format(host=self._host, port=self._port, run=self.is_running()))
|
||||
|
||||
data += buf.split('\r\n')
|
||||
if data[-1] == '':
|
||||
@ -502,8 +502,8 @@ class DynamipsHypervisor(object):
|
||||
buf = ''
|
||||
|
||||
if len(data) == 0:
|
||||
raise DynamipsError("no data returned from {host}:{port}"
|
||||
.format(host=self._host, port=self._port))
|
||||
raise DynamipsError("no data returned from {host}:{port}, Dynamips process running: {run}"
|
||||
.format(host=self._host, port=self._port, run=self.is_running()))
|
||||
|
||||
# Does it contain an error code?
|
||||
if self.error_re.search(data[-1]):
|
||||
|
@ -724,7 +724,7 @@ class VirtualBox(IModule):
|
||||
result = subprocess.check_output(command, stderr=subprocess.STDOUT, timeout=30)
|
||||
except (OSError, subprocess.SubprocessError) as e:
|
||||
raise VirtualBoxError("Could not execute VBoxManage {}".format(e))
|
||||
return result.decode("utf-8")
|
||||
return result.decode("utf-8", errors="ignore")
|
||||
|
||||
@IModule.route("virtualbox.vm_list")
|
||||
def vm_list(self, request):
|
||||
|
@ -560,7 +560,7 @@ class VirtualBoxVM(object):
|
||||
raise VirtualBoxError("{}".format(e))
|
||||
except (OSError, subprocess.SubprocessError) as e:
|
||||
raise VirtualBoxError("Could not execute VBoxManage: {}".format(e))
|
||||
return result.decode("utf-8").splitlines()
|
||||
return result.decode("utf-8", errors="ignore").splitlines()
|
||||
|
||||
def _get_vm_info(self):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user