From 7b531cf0943dd1f02ef88df9365cbb07c697a487 Mon Sep 17 00:00:00 2001 From: grossmj Date: Thu, 30 Oct 2014 21:10:14 -0600 Subject: [PATCH] Fixes issue when getting the VirtualBox VM list. --- gns3server/modules/virtualbox/__init__.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/gns3server/modules/virtualbox/__init__.py b/gns3server/modules/virtualbox/__init__.py index 31b7e50e..114563dd 100644 --- a/gns3server/modules/virtualbox/__init__.py +++ b/gns3server/modules/virtualbox/__init__.py @@ -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"]