mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-03 13:48:11 +00:00
Do not use universal_newlines in subprocess.
This commit is contained in:
parent
d97ba11728
commit
183a6aed44
@ -716,10 +716,10 @@ class VirtualBox(IModule):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result = subprocess.check_output(command, stderr=subprocess.STDOUT, universal_newlines=True, timeout=30)
|
result = subprocess.check_output(command, stderr=subprocess.STDOUT, timeout=30)
|
||||||
except subprocess.SubprocessError as e:
|
except subprocess.SubprocessError as e:
|
||||||
raise VirtualBoxError("Could not execute VBoxManage {}".format(e))
|
raise VirtualBoxError("Could not execute VBoxManage {}".format(e))
|
||||||
return result
|
return result.decode("utf-8")
|
||||||
|
|
||||||
@IModule.route("virtualbox.vm_list")
|
@IModule.route("virtualbox.vm_list")
|
||||||
def vm_list(self, request):
|
def vm_list(self, request):
|
||||||
|
@ -550,17 +550,17 @@ class VirtualBoxVM(object):
|
|||||||
command.extend(args)
|
command.extend(args)
|
||||||
log.debug("Execute vboxmanage command: {}".format(command))
|
log.debug("Execute vboxmanage command: {}".format(command))
|
||||||
try:
|
try:
|
||||||
result = subprocess.check_output(command, stderr=subprocess.STDOUT, universal_newlines=True, timeout=timeout)
|
result = subprocess.check_output(command, stderr=subprocess.STDOUT, timeout=timeout)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
if e.output:
|
if e.output:
|
||||||
# only the first line of the output is useful
|
# only the first line of the output is useful
|
||||||
virtualbox_error = e.output.splitlines()[0]
|
virtualbox_error = e.output.decode("utf-8").splitlines()[0]
|
||||||
raise VirtualBoxError("{}".format(virtualbox_error))
|
raise VirtualBoxError("{}".format(virtualbox_error))
|
||||||
else:
|
else:
|
||||||
raise VirtualBoxError("{}".format(e))
|
raise VirtualBoxError("{}".format(e))
|
||||||
except subprocess.SubprocessError as e:
|
except subprocess.SubprocessError as e:
|
||||||
raise VirtualBoxError("Could not execute VBoxManage: {}".format(e))
|
raise VirtualBoxError("Could not execute VBoxManage: {}".format(e))
|
||||||
return result.splitlines()
|
return result.decode("utf-8").splitlines()
|
||||||
|
|
||||||
def _get_vm_info(self):
|
def _get_vm_info(self):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user