[microdecision] Fix interface with meltdown checker script, stdout contains weird debug messages when ran inside LXC :|

This commit is contained in:
Alexandre Aubin 2019-02-16 18:43:14 +01:00
parent 2d3ff79683
commit 683d62d0e5

View file

@ -735,6 +735,14 @@ def _check_if_vulnerable_to_meltdown():
output, err = call.communicate()
assert call.returncode in (0, 2, 3), "Return code: %s" % call.returncode
# If there are multiple lines, sounds like there was some messages
# in stdout that are not json >.> ... Try to get the actual json
# stuff which should be the last line
output = output.strip()
if "\n" in output:
logger.debug("Original meltdown checker output : %s" % output)
output = output.split("\n")[-1]
CVEs = json.loads(output)
assert len(CVEs) == 1
assert CVEs[0]["NAME"] == "MELTDOWN"