mirror of
https://github.com/GNS3/gns3-server.git
synced 2024-12-20 21:33:09 +00:00
parent
0eafb6f06c
commit
da1cd9a3e7
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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")
|
||||
|
@ -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")
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user