1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-05 15:48:59 +00:00

Fixes issue when getting the VirtualBox VM list.

This commit is contained in:
grossmj 2014-10-30 21:10:14 -06:00
parent dab72cf036
commit 7b531cf094

View File

@ -62,8 +62,8 @@ class VirtualBox(IModule):
# get the vboxmanage location
self._vboxmanage_path = None
if sys.platform.startswith("win"):
os.path.join(os.environ["VBOX_INSTALL_PATH"], "VBoxManage.exe")
if sys.platform.startswith("win") and "VBOX_INSTALL_PATH" in os.environ:
self._vboxmanage_path = os.path.join(os.environ["VBOX_INSTALL_PATH"], "VBoxManage.exe")
else:
config = Config.instance()
vbox_config = config.get_section_config(name.upper())
@ -709,7 +709,13 @@ class VirtualBox(IModule):
"""
try:
if not self._vboxmanage_path or not os.path.exists(self._vboxmanage_path):
if request and "vboxmanage_path" in request:
vboxmanage_path = request["vboxmanage_path"]
else:
vboxmanage_path = self._vboxmanage_path
if not vboxmanage_path or not os.path.exists(vboxmanage_path):
raise VirtualBoxError("Could not find VBoxManage, is VirtualBox correctly installed?")
command = [self._vboxmanage_path, "--nologo", "list", "vms"]