1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-01 04:38:12 +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 # get the vboxmanage location
self._vboxmanage_path = None self._vboxmanage_path = None
if sys.platform.startswith("win"): if sys.platform.startswith("win") and "VBOX_INSTALL_PATH" in os.environ:
os.path.join(os.environ["VBOX_INSTALL_PATH"], "VBoxManage.exe") self._vboxmanage_path = os.path.join(os.environ["VBOX_INSTALL_PATH"], "VBoxManage.exe")
else: else:
config = Config.instance() config = Config.instance()
vbox_config = config.get_section_config(name.upper()) vbox_config = config.get_section_config(name.upper())
@ -709,7 +709,13 @@ class VirtualBox(IModule):
""" """
try: 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?") raise VirtualBoxError("Could not find VBoxManage, is VirtualBox correctly installed?")
command = [self._vboxmanage_path, "--nologo", "list", "vms"] command = [self._vboxmanage_path, "--nologo", "list", "vms"]