mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-24 17:28:08 +00:00
Fix IOU detection of layer 1 keepalive support. Fixes #1183.
This commit is contained in:
parent
67c78ba2e3
commit
1524493c33
@ -945,13 +945,13 @@ class IOUVM(BaseNode):
|
||||
if "IOURC" not in os.environ:
|
||||
env["IOURC"] = self.iourc_path
|
||||
try:
|
||||
output = yield from gns3server.utils.asyncio.subprocess_check_output(self._path, "-h", cwd=self.working_dir, env=env)
|
||||
output = yield from gns3server.utils.asyncio.subprocess_check_output(self._path, "-h", cwd=self.working_dir, env=env, stderr=True)
|
||||
if re.search("-l\s+Enable Layer 1 keepalive messages", output):
|
||||
command.extend(["-l"])
|
||||
else:
|
||||
raise IOUError("layer 1 keepalive messages are not supported by {}".format(os.path.basename(self._path)))
|
||||
except (OSError, subprocess.SubprocessError) as e:
|
||||
log.warn("could not determine if layer 1 keepalive messages are supported by {}: {}".format(os.path.basename(self._path), e))
|
||||
log.warning("could not determine if layer 1 keepalive messages are supported by {}: {}".format(os.path.basename(self._path), e))
|
||||
|
||||
@property
|
||||
def startup_config_content(self):
|
||||
|
@ -41,16 +41,21 @@ def wait_run_in_executor(func, *args, **kwargs):
|
||||
|
||||
|
||||
@asyncio.coroutine
|
||||
def subprocess_check_output(*args, cwd=None, env=None):
|
||||
def subprocess_check_output(*args, cwd=None, env=None, stderr=False):
|
||||
"""
|
||||
Run a command and capture output
|
||||
|
||||
:param *args: List of command arguments
|
||||
:param cwd: Current working directory
|
||||
:param env: Command environment
|
||||
:param stderr: Read on stderr
|
||||
:returns: Command output
|
||||
"""
|
||||
|
||||
if stderr:
|
||||
proc = yield from asyncio.create_subprocess_exec(*args, stderr=asyncio.subprocess.PIPE, cwd=cwd, env=env)
|
||||
output = yield from proc.stderr.read()
|
||||
else:
|
||||
proc = yield from asyncio.create_subprocess_exec(*args, stdout=asyncio.subprocess.PIPE, cwd=cwd, env=env)
|
||||
output = yield from proc.stdout.read()
|
||||
if output is None:
|
||||
@ -60,7 +65,6 @@ def subprocess_check_output(*args, cwd=None, env=None):
|
||||
# and the code of VPCS, dynamips... Will detect it's not the correct binary
|
||||
return output.decode("utf-8", errors="ignore")
|
||||
|
||||
|
||||
@asyncio.coroutine
|
||||
def wait_for_process_termination(process, timeout=10):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user