mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-12 19:38:57 +00:00
Checks for missing shared library dependencies in the IOU image.
This commit is contained in:
parent
32436b0051
commit
6632af9776
@ -21,6 +21,7 @@ order to run an IOU instance.
|
||||
"""
|
||||
|
||||
import os
|
||||
import re
|
||||
import socket
|
||||
import errno
|
||||
import signal
|
||||
@ -407,6 +408,23 @@ class IOUDevice(object):
|
||||
log.error("could not start iouyap: {}\n{}".format(e, iouyap_stdout))
|
||||
raise IOUError("Could not start iouyap: {}\n{}".format(e, iouyap_stdout))
|
||||
|
||||
def _library_check(self):
|
||||
"""
|
||||
Checks for missing shared library dependencies in the IOU image.
|
||||
"""
|
||||
|
||||
try:
|
||||
output = subprocess.check_output(["ldd", self._path])
|
||||
except subprocess.SubprocessError as e:
|
||||
log.warn("could not determine the shared library dependencies for {}".format(self._path))
|
||||
return
|
||||
|
||||
p = re.compile("([\.\w]+)\s=>\s+not found")
|
||||
missing_libs = p.findall(output.decode("utf-8"))
|
||||
if missing_libs:
|
||||
raise IOUError("The following shared library dependencies cannot be found for IOU image {}: {}".format(self._path,
|
||||
", ".join(missing_libs)))
|
||||
|
||||
def start(self):
|
||||
"""
|
||||
Starts the IOU process.
|
||||
@ -432,6 +450,8 @@ class IOUDevice(object):
|
||||
if not os.access(self._path, os.X_OK):
|
||||
raise IOUError("IOU image '{}' is not executable".format(self._path))
|
||||
|
||||
self._library_check()
|
||||
|
||||
if not self._iourc or not os.path.isfile(self._iourc):
|
||||
raise IOUError("A iourc file is necessary to start IOU")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user