mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-28 03:08:14 +00:00
Changes how to look for vpcs and iouyap locations.
This commit is contained in:
parent
e41afbb5c6
commit
119eb635cf
@ -69,18 +69,15 @@ class IOU(IModule):
|
|||||||
iou_config = config.get_section_config(name.upper())
|
iou_config = config.get_section_config(name.upper())
|
||||||
self._iouyap = iou_config.get("iouyap")
|
self._iouyap = iou_config.get("iouyap")
|
||||||
if not self._iouyap or not os.path.isfile(self._iouyap):
|
if not self._iouyap or not os.path.isfile(self._iouyap):
|
||||||
iouyap_in_cwd = os.path.join(os.getcwd(), "iouyap")
|
paths = [os.getcwd()] + os.environ["PATH"].split(":")
|
||||||
if os.path.isfile(iouyap_in_cwd):
|
# look for iouyap in the current working directory and $PATH
|
||||||
self._iouyap = iouyap_in_cwd
|
for path in paths:
|
||||||
else:
|
try:
|
||||||
# look for iouyap if none is defined or accessible
|
if "iouyap" in os.listdir(path) and os.access(os.path.join(path, "iouyap"), os.X_OK):
|
||||||
for path in os.environ["PATH"].split(":"):
|
self._iouyap = os.path.join(path, "iouyap")
|
||||||
try:
|
break
|
||||||
if "iouyap" in os.listdir(path) and os.access(os.path.join(path, "iouyap"), os.X_OK):
|
except OSError:
|
||||||
self._iouyap = os.path.join(path, "iouyap")
|
continue
|
||||||
break
|
|
||||||
except OSError:
|
|
||||||
continue
|
|
||||||
|
|
||||||
if not self._iouyap:
|
if not self._iouyap:
|
||||||
log.warning("iouyap binary couldn't be found!")
|
log.warning("iouyap binary couldn't be found!")
|
||||||
|
@ -66,18 +66,15 @@ class VPCS(IModule):
|
|||||||
vpcs_config = config.get_section_config(name.upper())
|
vpcs_config = config.get_section_config(name.upper())
|
||||||
self._vpcs = vpcs_config.get("vpcs")
|
self._vpcs = vpcs_config.get("vpcs")
|
||||||
if not self._vpcs or not os.path.isfile(self._vpcs):
|
if not self._vpcs or not os.path.isfile(self._vpcs):
|
||||||
vpcs_in_cwd = os.path.join(os.getcwd(), "vpcs")
|
paths = [os.getcwd()] + os.environ["PATH"].split(":")
|
||||||
if os.path.isfile(vpcs_in_cwd):
|
# look for VPCS in the current working directory and $PATH
|
||||||
self._vpcs = vpcs_in_cwd
|
for path in paths:
|
||||||
else:
|
try:
|
||||||
# look for vpcs if none is defined or accessible
|
if "vpcs" in os.listdir(path) and os.access(os.path.join(path, "vpcs"), os.X_OK):
|
||||||
for path in os.environ["PATH"].split(":"):
|
self._vpcs = os.path.join(path, "vpcs")
|
||||||
try:
|
break
|
||||||
if "vpcs" in os.listdir(path) and os.access(os.path.join(path, "vpcs"), os.X_OK):
|
except OSError:
|
||||||
self._vpcs = os.path.join(path, "vpcs")
|
continue
|
||||||
break
|
|
||||||
except OSError:
|
|
||||||
continue
|
|
||||||
|
|
||||||
if not self._vpcs:
|
if not self._vpcs:
|
||||||
log.warning("VPCS binary couldn't be found!")
|
log.warning("VPCS binary couldn't be found!")
|
||||||
@ -241,6 +238,9 @@ class VPCS(IModule):
|
|||||||
except OSError as e:
|
except OSError as e:
|
||||||
raise VPCSError("Could not create working directory {}".format(e))
|
raise VPCSError("Could not create working directory {}".format(e))
|
||||||
|
|
||||||
|
if not self._vpcs:
|
||||||
|
raise VPCSError("No path to a VPCS executable has been set")
|
||||||
|
|
||||||
vpcs_instance = VPCSDevice(self._vpcs,
|
vpcs_instance = VPCSDevice(self._vpcs,
|
||||||
self._working_dir,
|
self._working_dir,
|
||||||
self._host,
|
self._host,
|
||||||
|
@ -321,6 +321,9 @@ class VPCSDevice(object):
|
|||||||
|
|
||||||
if not self.is_running():
|
if not self.is_running():
|
||||||
|
|
||||||
|
if not self._path:
|
||||||
|
raise VPCSError("No path to a VPCS executable has been set")
|
||||||
|
|
||||||
if not os.path.isfile(self._path):
|
if not os.path.isfile(self._path):
|
||||||
raise VPCSError("VPCS '{}' is not accessible".format(self._path))
|
raise VPCSError("VPCS '{}' is not accessible".format(self._path))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user