mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-24 17:28:08 +00:00
Do not look for vboxwrapper on non Windows platforms.
This commit is contained in:
parent
a8d740ef21
commit
e0f0c98ffd
@ -60,25 +60,26 @@ class VirtualBox(IModule):
|
|||||||
|
|
||||||
def __init__(self, name, *args, **kwargs):
|
def __init__(self, name, *args, **kwargs):
|
||||||
|
|
||||||
# get the vboxwrapper location
|
# get the vboxwrapper location (only non-Windows platforms)
|
||||||
config = Config.instance()
|
if not sys.platform.startswith("win"):
|
||||||
vbox_config = config.get_section_config(name.upper())
|
config = Config.instance()
|
||||||
self._vboxwrapper_path = vbox_config.get("vboxwrapper_path")
|
vbox_config = config.get_section_config(name.upper())
|
||||||
if not self._vboxwrapper_path or not os.path.isfile(self._vboxwrapper_path):
|
self._vboxwrapper_path = vbox_config.get("vboxwrapper_path")
|
||||||
paths = [os.getcwd()] + os.environ["PATH"].split(":")
|
if not self._vboxwrapper_path or not os.path.isfile(self._vboxwrapper_path):
|
||||||
# look for iouyap in the current working directory and $PATH
|
paths = [os.getcwd()] + os.environ["PATH"].split(":")
|
||||||
for path in paths:
|
# look for iouyap in the current working directory and $PATH
|
||||||
try:
|
for path in paths:
|
||||||
if "vboxwrapper" in os.listdir(path) and os.access(os.path.join(path, "vboxwrapper"), os.X_OK):
|
try:
|
||||||
self._vboxwrapper_path = os.path.join(path, "vboxwrapper")
|
if "vboxwrapper" in os.listdir(path) and os.access(os.path.join(path, "vboxwrapper"), os.X_OK):
|
||||||
break
|
self._vboxwrapper_path = os.path.join(path, "vboxwrapper")
|
||||||
except OSError:
|
break
|
||||||
continue
|
except OSError:
|
||||||
|
continue
|
||||||
|
|
||||||
if not self._vboxwrapper_path:
|
if not self._vboxwrapper_path:
|
||||||
log.warning("vboxwrapper couldn't be found!")
|
log.warning("vboxwrapper couldn't be found!")
|
||||||
elif not os.access(self._vboxwrapper_path, os.X_OK):
|
elif not os.access(self._vboxwrapper_path, os.X_OK):
|
||||||
log.warning("vboxwrapper is not executable")
|
log.warning("vboxwrapper is not executable")
|
||||||
|
|
||||||
# a new process start when calling IModule
|
# a new process start when calling IModule
|
||||||
IModule.__init__(self, name, *args, **kwargs)
|
IModule.__init__(self, name, *args, **kwargs)
|
||||||
|
Loading…
Reference in New Issue
Block a user