mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-24 09:18:08 +00:00
Changes how to look for vpcs and iouyap locations.
This commit is contained in:
parent
e41afbb5c6
commit
119eb635cf
@ -69,12 +69,9 @@ class IOU(IModule):
|
||||
iou_config = config.get_section_config(name.upper())
|
||||
self._iouyap = iou_config.get("iouyap")
|
||||
if not self._iouyap or not os.path.isfile(self._iouyap):
|
||||
iouyap_in_cwd = os.path.join(os.getcwd(), "iouyap")
|
||||
if os.path.isfile(iouyap_in_cwd):
|
||||
self._iouyap = iouyap_in_cwd
|
||||
else:
|
||||
# look for iouyap if none is defined or accessible
|
||||
for path in os.environ["PATH"].split(":"):
|
||||
paths = [os.getcwd()] + os.environ["PATH"].split(":")
|
||||
# look for iouyap in the current working directory and $PATH
|
||||
for path in paths:
|
||||
try:
|
||||
if "iouyap" in os.listdir(path) and os.access(os.path.join(path, "iouyap"), os.X_OK):
|
||||
self._iouyap = os.path.join(path, "iouyap")
|
||||
|
@ -66,12 +66,9 @@ class VPCS(IModule):
|
||||
vpcs_config = config.get_section_config(name.upper())
|
||||
self._vpcs = vpcs_config.get("vpcs")
|
||||
if not self._vpcs or not os.path.isfile(self._vpcs):
|
||||
vpcs_in_cwd = os.path.join(os.getcwd(), "vpcs")
|
||||
if os.path.isfile(vpcs_in_cwd):
|
||||
self._vpcs = vpcs_in_cwd
|
||||
else:
|
||||
# look for vpcs if none is defined or accessible
|
||||
for path in os.environ["PATH"].split(":"):
|
||||
paths = [os.getcwd()] + os.environ["PATH"].split(":")
|
||||
# look for VPCS in the current working directory and $PATH
|
||||
for path in paths:
|
||||
try:
|
||||
if "vpcs" in os.listdir(path) and os.access(os.path.join(path, "vpcs"), os.X_OK):
|
||||
self._vpcs = os.path.join(path, "vpcs")
|
||||
@ -241,6 +238,9 @@ class VPCS(IModule):
|
||||
except OSError as 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,
|
||||
self._working_dir,
|
||||
self._host,
|
||||
|
@ -321,6 +321,9 @@ class VPCSDevice(object):
|
||||
|
||||
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):
|
||||
raise VPCSError("VPCS '{}' is not accessible".format(self._path))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user