diff --git a/gns3server/modules/base_vm.py b/gns3server/modules/base_vm.py index b5030c26..a3684b69 100644 --- a/gns3server/modules/base_vm.py +++ b/gns3server/modules/base_vm.py @@ -403,11 +403,10 @@ class BaseVM: """ path = self._manager.config.get_section_config("Server").get("ubridge_path", "ubridge") - if path == "ubridge": - path = shutil.which("ubridge") + path = shutil.which(path) if path is None or len(path) == 0: - raise VMError("uBridge is not installed") + raise VMError("uBridge is not installed or uBridge path is invalid") return path @asyncio.coroutine diff --git a/gns3server/modules/dynamips/__init__.py b/gns3server/modules/dynamips/__init__.py index e5df157a..c781952e 100644 --- a/gns3server/modules/dynamips/__init__.py +++ b/gns3server/modules/dynamips/__init__.py @@ -336,16 +336,16 @@ class Dynamips(BaseManager): def find_dynamips(self): # look for Dynamips - dynamips_path = self.config.get_section_config("Dynamips").get("dynamips_path") - if not dynamips_path: - dynamips_path = shutil.which("dynamips") + dynamips_path = self.config.get_section_config("Dynamips").get("dynamips_path", "dynamips") + if not os.path.isabs(dynamips_path): + dynamips_path = shutil.which(dynamips_path) if not dynamips_path: raise DynamipsError("Could not find Dynamips") if not os.path.isfile(dynamips_path): raise DynamipsError("Dynamips {} is not accessible".format(dynamips_path)) if not os.access(dynamips_path, os.X_OK): - raise DynamipsError("Dynamips is not executable") + raise DynamipsError("Dynamips {} is not executable".format(dynamips_path)) self._dynamips_path = dynamips_path return dynamips_path diff --git a/gns3server/modules/iou/iou_vm.py b/gns3server/modules/iou/iou_vm.py index b6dd548f..4105b55c 100644 --- a/gns3server/modules/iou/iou_vm.py +++ b/gns3server/modules/iou/iou_vm.py @@ -230,9 +230,11 @@ class IOUVM(BaseVM): :returns: path to IOUYAP """ - path = self._manager.config.get_section_config("IOU").get("iouyap_path", "iouyap") - if path == "iouyap": - path = shutil.which("iouyap") + search_path = self._manager.config.get_section_config("IOU").get("iouyap_path", "iouyap") + path = shutil.which(search_path) + # shutil.which return None if the path doesn't exists + if not path: + return search_path return path @property diff --git a/gns3server/modules/virtualbox/__init__.py b/gns3server/modules/virtualbox/__init__.py index e5299a66..45085b07 100644 --- a/gns3server/modules/virtualbox/__init__.py +++ b/gns3server/modules/virtualbox/__init__.py @@ -66,7 +66,10 @@ class VirtualBox(BaseManager): elif sys.platform.startswith("darwin"): vboxmanage_path = "/Applications/VirtualBox.app/Contents/MacOS/VBoxManage" else: - vboxmanage_path = shutil.which("vboxmanage") + vboxmanage_path = "vboxmanage" + + if not os.path.abspath(vboxmanage_path): + vboxmanage_path = shutil.which(vboxmanage_path) if not vboxmanage_path: raise VirtualBoxError("Could not find VBoxManage") diff --git a/gns3server/modules/vmware/__init__.py b/gns3server/modules/vmware/__init__.py index 802911d4..a9cd6108 100644 --- a/gns3server/modules/vmware/__init__.py +++ b/gns3server/modules/vmware/__init__.py @@ -105,7 +105,10 @@ class VMware(BaseManager): elif sys.platform.startswith("darwin"): vmrun_path = "/Applications/VMware Fusion.app/Contents/Library/vmrun" else: - vmrun_path = shutil.which("vmrun") + vmrun_path = "vmrun" + + if not os.path.abspath(vmrun_path): + vmrun_path = shutil.which(vmrun_path) if not vmrun_path: raise VMwareError("Could not find VMware vmrun, please make sure it is installed") diff --git a/gns3server/modules/vpcs/vpcs_vm.py b/gns3server/modules/vpcs/vpcs_vm.py index 16984918..e1b11bea 100644 --- a/gns3server/modules/vpcs/vpcs_vm.py +++ b/gns3server/modules/vpcs/vpcs_vm.py @@ -139,9 +139,11 @@ class VPCSVM(BaseVM): :returns: path to VPCS """ - path = self._manager.config.get_section_config("VPCS").get("vpcs_path", "vpcs") - if path == "vpcs": - path = shutil.which("vpcs") + search_path = self._manager.config.get_section_config("VPCS").get("vpcs_path", "vpcs") + path = shutil.which(search_path) + # shutil.which return None if the path doesn't exists + if not path: + return search_path return path @BaseVM.name.setter